View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone[_2_] Jim Cone[_2_] is offline
external usenet poster
 
Posts: 1,549
Default Problem with UserForm1.Show

Steve,
You are welcome... appreciate getting the feedback.
'---
Jim Cone



"Steve"
wrote in message
...
And it's just that easy! Thanks Jim!!

On Feb 14, 12:27 pm, "Jim Cone"
wrote:
"Cells" refers to the active sheet unless you tell Excel differently.
A hidden workbook is not active and has no active sheets.
Change your code so that "Cells" has a parent called out...
'---
Set mRng = _
Sheets("Picklist").Range(Sheets("Picklist").Cells( 2, "a"), _
Sheets("Picklist").Cells(2, "a").End(xlDown))
'---
Jim Cone
Portland, Oregon USA .
http://www.mediafire.com/PrimitiveSoftware .
(Extras for Excel: Date picker, Clean Data, Classic Menu ...)




"Steve"
wrote in messagenews:

...
Hi All. I have the following bits of code:


Sub Main()
UserForm1.Show
End Sub


Private Sub UserForm_Initialize()
Set mRng = Sheets("Picklist").Range(Cells(2, "a"), Cells(2,
"a").End(xlDown))
For Each c In mRng
ComboBox1.AddItem c
Next c
End Sub


I would like my Sheet "Picklist" to be hidden. When it is hidden, my
code errors out on the line UserForm1.Show. When I unhide the sheet
"Picklist" and execute the code, it works perfectly.
Any ideas on how I can execute the code while the sheet "Picklist" is
hidden??
Thanks so much.- Hide quoted text -


- Show quoted text -