Version Conflict With Find/Replace?

ILoveCheese

New Member
Joined
Mar 27, 2008
Messages
27
Rich (BB code):
Worksheets("Main").Range("C3:GT69").Select
   Selection.Replace What:="X", Replacement:="", LookAt:=xlPart, _
       SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
       ReplaceFormat:=False

I am working with version 03, and I do not have any issues with the above code. I sent it to a friend who is using 00, and they receive a "application-defined or object-defined error message.... runtime error 1004".

To create the code I used the recorder, highlighted the range did a CTRL H and applied the needed replacement.


Could this issue be due to the difference in versions? Just need some clarification.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Just to be sure, do they also have a sheet named "Main"?

Also, you could just use:

Code:
Worksheets("Main").Range("C3:GT69").Replace What:="X", Replacement:="", LookAt:=xlPart, _
       SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
       ReplaceFormat:=False
 
Upvote 0
Yes they do. I sent them the entire workbook, and they haven't renamed/changed anything within it. I can't figure out where the disconnect is.
 
Upvote 0
Have them record the same macro and see if they get similar code. Otherwise, I'm completely stumped...

Sorry for not being more help.
 
Upvote 0
You don't have to go to the sheet, this will do:

Code:
Worksheets("Main").Range("C3:GT69").Replace What:="X", Replacement:="", LookAt:=xlPart

If you want to activate the sheet, do this:

Code:
Worksheets("Main").Activate
Range("C3:GT69").Replace What:="X", Replacement:="", LookAt:=xlPart


If you want to go to a particular range on a sheet DO NOT do this which you did:
Worksheets("Main").Range("C3:GT69").Select


That will fail if executed from a sheet other than the Main sheet.


Do this instead, though as I said before, no reason to select beforehand:


Application.GoTo Worksheets("Main").Range("C3:GT69")
 
Last edited:
Upvote 0
I actually hadn't even thought of that. I'll give it a go and do a compare.

Thx.

I'm wondering if there is a listing of issues related to backwards compatibility between 03 and 00 floating around anywhere as well.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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