Run time error 1004 - Method 'range of object' _ 'global failed'

Pauljj

Well-known Member
Joined
Mar 28, 2004
Messages
2,047
This error message is coming up at this point in my code

Set C1 = Range(Cells(3, 7), Cells(3, 165)).Find(Range(vData).Value, LookIn:=xlValues, lookat:=xlWhole)



I think it has something to do with it trying to find vdata which is a week number

I am trying to find week number 1 between cells 3,7 and 3,165 can anyone see something glaringly obvious that I can't ?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
It seems to be a problem with your variable vData, what type is it and how do you define it?
 
Upvote 0
This works for me anyway:
Code:
Sub TryMe()
Dim C1 As Range
Dim vData As String
vData = Range("A1")
Set C1 = Range(Cells(3, 7), Cells(3, 165)).Find(vData, LookIn:=xlValues, lookat:=xlWhole)
C1.Select
End Sub
Where A1 has the word "Hello" and I've also placed that word in cell M3
 
Upvote 0
Legendary Jack, thanks very much, I changed this part as per your message Find(vData,

and it worked perfectly

Thanks very much

Paul
 
Upvote 0

Forum statistics

Threads
1,224,534
Messages
6,179,391
Members
452,909
Latest member
VickiS

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