Click to See Complete Forum and Search --> : load workbook data to UserForm
bolcskei
Jan 13th, 2005, 01:08 AM
I would like to load data to UserForm. I wrote the code, but I do not know where is the mistake.
Please help
Sub Show_HK()
UserForm2.KeepScrollBarsVisible = fmScrollBarsNone
UserForm2.ScrollBars = fmScrollBarsVertical
UserForm2.Spreadsheet1.Toolbar.Appearance = cc3D
Dim i As Long, j As Long, k As Long
k = Worksheets("$").range("D3").Value
For i = 1 To k
For j = 1 To 12
UserForm2.Spreadsheet1.Cells(i, j).Value = Workbooks("C:\Documents and Settings\bolcskei\Dokumenty\FA\TV\HKA 2004 1.0.xls").Worksheet("HK2").Cells(i, j).Value
Next j
Next i
UserForm2.Show (vbModeless)
End Sub
RobDog888
Jan 13th, 2005, 12:42 PM
What is the error? Just a comment, but whygo to all the trouble of creating an
Excel userform with the entire spreadsheet contents? Why not just use Excel as is for this?
bolcskei
Jan 14th, 2005, 01:35 AM
What is the error? Just a comment, but whygo to all the trouble of creating an
Excel userform with the entire spreadsheet contents? Why not just use Excel as is for this?
When I run the macro error 9 I receive. When I am working with some data on the sheet somethimes I would like to see another datas which are not present on the activated sheet, but I do not want to open and close some other excel files. For example when I am working with Balance Sheet of the company I would like to check datas from the Main book. My aim to load data the using UserForm could be more confortable to use.
RobDog888
Jan 14th, 2005, 10:58 AM
I would have to think that the subscript out of range error is from this line
of code because the dollar sign is a reserved character in Excel. It thinks
there should be a value after it. Try changing the sheet name to something
else.
k = Worksheets("$").range("D3").Value
bolcskei
Jan 17th, 2005, 12:10 AM
I would have to think that the subscript out of range error is from this line
of code because the dollar sign is a reserved character in Excel. It thinks
there should be a value after it. Try changing the sheet name to something
else.
k = Worksheets("$").range("D3").Value
No. I have problem with this:
UserForm2.Spreadsheet1.Cells(i, j).Value = Workbooks("C:\Documents and Settings\bolcskei\Dokumenty\FA\TV\HKA 2004 1.0.xls").Worksheet("HK2").Cells(i, j).Value
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.