Find word throughout range and capitalize

Pjam

Board Regular
Joined
Jun 4, 2008
Messages
139
Im looking to find the word sample throughout my spreadsheet its, scattered every where, and i need to change sample to Sample,
and idea?

the range is a1:z500
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Sub find_Sample()
With Worksheets(1).Range("a1:z500")
Set c = .Find(sample, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Replace "s", "S"
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End Sub
 
Upvote 0
try
Code:
Sub test()
Dim ws As Worksheet
For Each ws In Sheets
    ws.UsedRange.Replace What:="sample", Replacement:="Sample", _
                  MatchCase:=True 
Next
End Sub
 
Upvote 0
Hi

You can also use the Replace from the worksheet

Replace: sample
with: Sample

, check the Whole word checkbox.
 
Upvote 0

Forum statistics

Threads
1,214,814
Messages
6,121,711
Members
449,049
Latest member
THMarana

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