PDA

View Full Version : Solved: Need help with UserForm RunTime error 1004



rgr
04-01-2006, 07:28 AM
I have a userform named PlayerEntryForm.

Here's the code to open it:
Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim ws As Worksheet
Dim player1 As Range
Dim player2 As Range
Dim player3 As Range
Dim player4 As Range
Set player1 = Range("B5:B36")
Set player2 = Range("D5:D36")
Set player3 = Range("H5:H36")
Set player4 = Range("J5:J36")
Set ws = Sheet1
For Each Target In Selection
If Application.Intersect(Selection, player1) Is Nothing _
And Application.Intersect(Selection, player2) Is Nothing _
And Application.Intersect(Selection, player3) Is Nothing _
And Application.Intersect(Selection, player4) Is Nothing Then
MsgBox "Select Partnership Cell"
Else
PlayerEntryForm.Show
End If
Next
End Sub

Every time I test it I get "method range of object _global failed", which pinpoints the userform.
I''ve tried declaring it, loading it, same error, can some one help me please?

matthewspatrick
04-01-2006, 09:04 AM
Go to the VB Editor, select Tools|Options from the menu, and go to the general tab. Under error trapping, select break in class module. There is something in the UserForm code causing the problem.

rgr
04-01-2006, 10:00 AM
Thank you very much Patrick, the error pointed to a named range, which, upon inspection, was defined incorrectly. So much to learn, so little time.

rgr
04-01-2006, 10:13 AM
I can't seem to fimd the "solved" option in the thread tools.

lucas
04-01-2006, 11:54 AM
marked solved

bijunator
08-03-2014, 10:33 PM
thanks for this quote by Abe Lincoln. Excellent one... :-)