find function eroors

phillypdh

Board Regular
Joined
Jun 23, 2011
Messages
66
i have a function and i keep getting method range of object global
failed error.
Code:
Function Find_Range(Find_Item As Variant, _
Search_Range As Range, _
Optional LookIn As Variant, _
Optional LookAt As Variant, _
Optional MatchCase As Boolean) As Range
 
Dim c As Range
If IsMissing(LookIn) Then LookIn = xlValues 'xlFormulas
If IsMissing(LookAt) Then LookAt = xlPart 'xlWhole
If IsMissing(MatchCase) Then MatchCase = False
 
With Search_Range
Set c = .Find( _
What:=Find_Item, _
LookIn:=LookIn, _
LookAt:=LookAt, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=MatchCase, _
SearchFormat:=False)
If Not c Is Nothing Then
Set Find_Range = c
firstaddress = c.Address
Do
Set Find_Range = Union(Find_Range, c)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstaddress
End If
End With
 
End Function
can anyone assist?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Code:
Find_Range("Only", Columns("H"), xlFormulas, xlWhole).EntireRow.Copy Range("Sheet3!A1")
this is where the error occurs.
 
Upvote 0
Find_Range("Only", Columns("H"), xlFormulas, xlWhole).EntireRow.Copy Range("Sheet3!A1")

Probably needs to be

Find_Range("Only", Columns("H"), xlFormulas, xlWhole).EntireRow.Copy Sheets("Sheet3").Range("A1")
 
Upvote 0
That would indicate Sheet3 doesn't exist...
Check the spelling, and for extra spaces in the actual sheet's tab name...
 
Upvote 0
thanks alot you are the MAN! oh wait-

object variable or with block variable not set.
 
Last edited:
Upvote 0
Code:
 Find_Range("Only", Columns("H"), xlFormulas, xlWhole).EntireRow.Copy Sheets("FHA'S W IMAGE").Range("A1")

    Find_Range("Chase", Columns("H"), xlFormulas, xlWhole).EntireRow.Copy Sheets("FHA C_SIGN W IMAGE").Range("A1")

this gives the obj variable error.
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,555
Members
452,928
Latest member
101blockchains

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