Specify Range error

SIGE

Board Regular
Joined
Oct 6, 2010
Messages
88
Hello,

I run into a Run-time error '1004'
Method "Range" of Object "_Worksheet" failed.

when trying trying to specify this range:
Code:
iS=Application.WorksheetFunction.Match(Sheet1.Range("A3"), Sheet1.Range(Cells(6, 1), Cells(Rows.Count, 1).End(xlUp)), 0)

Can someone pinpoint what I am doing wrong in my Range-specification?

Thanks in advance, Sige
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
I wouldn't use Is as a variable name. Try

Code:
X = Application.WorksheetFunction.Match(Sheet1.Range("A3"), Sheet1.Range(Sheet1.Cells(6, 1), Sheet1.Cells(Rows.Count, 1).End(xlUp)), 0)
 
Upvote 0
Hi Peter,

Code:
 iTF = Application.WorksheetFunction.Match(UserAdministration.Range("A3"), UserAdministration.Range(Cells(6, 1), Cells(Rows.Count, 1).End(xlUp)), 0)
MsgBox iTF

Still generates the same error:confused:

The sheet UserAdministration(Usersheet) exists as well. I am confused...

Any other suggestion on what might be wrong?
Sige
 
Upvote 0
You're still not qualifying the Cells property. Try:

Code:
    With UserAdministration
        iTF = Application.WorksheetFunction.Match(.Range("A3"), .Range(.Cells(6, 1), .Cells(Rows.Count, 1).End(xlUp)), 0)
    End With
 
Upvote 0
Hi Andrew,

It are such subtleties that are killing ...
Still do not see/understand completelythe difference between your solution and my initial code...
Anyway,thanks a lot for your help!

Up to the next problem!
Sige
 
Upvote 0
Your code should have been:

Rich (BB code):
iTF = Application.WorksheetFunction.Match(UserAdministration.Range("A3"), UserAdministration.Range(UserAdministration.Cells(6, 1), UserAdministration.Cells(Rows.Count, 1).End(xlUp)), 0)
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,256
Members
452,901
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top