The VBA help file example is good.
The VBA help file example is good.
Hope that helps.
RoyUK
--------
For Excel Tips & Solutions, free examples and tutorials why not check out my web site
Free DataBaseForm example
Originally Posted by royUK
Ive looked at that, but Im very new so theres a couple things that are different than the method ive posted that look different that im not sure about.![]()
With Worksheets(1).Range("a1:a500") Set c = .Find(2, lookin:=xlValues) If Not c Is Nothing Then firstAddress = c.Address Do c.Value = 5 Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address <> firstAddress End If End With
I would like to search the entire active worksheet as opposed to a specified range and also I tried doing the select worksheet thing but I dont know which worksheet in the workbook the macro is going to be run on, so i would just like it run on the active worksheet. Ive tried adapting that syntax to use the .find method ive posted above and I cant seem to get it to work.![]()
Worksheets(1).Range("a1:a500")
When working with the active worksheet you do not need to use worksheets(1) in the code
As the above example finds 2 and replaces that with 5 you could use![]()
With Cells Set c = .Find(2, LookIn:=xlValues) If Not c Is Nothing Then firstAddress = c.Address Do c.Value = 5 Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address <> firstAddress End If End With
![]()
Cells.Replace What:="2", Replacement:="5", LookAt:=xlWhole, SearchOrder _ :=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Please Read Forum Rules Before Posting
Wrap VBA code by selecting the code and clicking the # icon or Read This
How To Cross Post politely
Top Excel links for beginners to Experts
If you are pleased with a member's answer then use the Scales icon to rate it
If my reply has assistedor failed to assist you
I welcome your Feedback.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks