Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default User Form-error 1004 unless opened in sheet w/combobox data

hi there,

one last prob w/my user form: my comboboxes are filled with data fro
sheet(4) also named "data" and work fine as long as sheet(4) is open i
the background. the prob is, that i would like sheet(1) to be open i
the background while i use the form.

i am getting runtime error 1004 method range of object_global faile
when i try to open my user form while in sheet(1).

when i debug, the macro gets stuck in an endless loop with the cod
below.

Private Sub userform_initialize()

With Worksheets("data")

For Each Cell In Worksheets("data").Range("f1:f500")
If Cell.Row < 1 Then
res = Application.Match(Cell.Value, Range(Range("f1"),Cell.Offset(-1
0)), 0)
If IsError(res) Then
Combobox1.AddItem Cell.Value
End If
Else
Combobox1.AddItem Cell.Value
End If
Next

For Each....

thanks again!
din

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default User Form-error 1004 unless opened in sheet w/combobox data

You have an unqualified range and unqualified ranges will go to the active sheet
and if that activesheet isn't "data", then you've got trouble with a capital T.

With Worksheets("data")
For Each Cell In .Range("f1:f500")
If Cell.Row < 1 Then
res = Application.Match(Cell.Value, _
.Range(.Range("f1"),Cell.Offset(-1,0)), 0)
If IsError(res) Then
Combobox1.AddItem Cell.Value
End If
Else
Combobox1.AddItem Cell.Value
End If
Next
end with

Those dots in front of .range() mean that it belongs to the previous With
statement (with worksheets("data") in this case.



"dpaulos <" wrote:

hi there,

one last prob w/my user form: my comboboxes are filled with data from
sheet(4) also named "data" and work fine as long as sheet(4) is open in
the background. the prob is, that i would like sheet(1) to be open in
the background while i use the form.

i am getting runtime error 1004 method range of object_global failed
when i try to open my user form while in sheet(1).

when i debug, the macro gets stuck in an endless loop with the code
below.

Private Sub userform_initialize()

With Worksheets("data")

For Each Cell In Worksheets("data").Range("f1:f500")
If Cell.Row < 1 Then
res = Application.Match(Cell.Value, Range(Range("f1"),Cell.Offset(-1,
0)), 0)
If IsError(res) Then
Combobox1.AddItem Cell.Value
End If
Else
Combobox1.AddItem Cell.Value
End If
Next

For Each....

thanks again!
dina

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default User Form-error 1004 unless opened in sheet w/combobox data

wow. you guys are quick!! Dave, thanks so much for your help, this
form is DONE. i had a feeling it was a range problem.
thanks,
dina


---
Message posted from http://www.ExcelForum.com/

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to protect cells in macro sheet b/c runtime error 1004 rldjda Excel Worksheet Functions 1 March 20th 08 08:28 PM
run time error 1004 for other user [email protected] Excel Discussion (Misc queries) 1 January 26th 06 09:42 AM
Error 1004 using array in Sheet select. Trefor Excel Discussion (Misc queries) 4 September 7th 05 07:29 PM
MS JET database engine error: workgroup information file is missing or opened exclusively by another user Tina Excel Discussion (Misc queries) 0 August 24th 05 01:40 AM
User Form Error theguz Excel Discussion (Misc queries) 3 August 15th 05 10:49 PM


All times are GMT +1. The time now is 07:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"