-
Solved: find/replace in protect worksheet
hi,
i would like to perform "find/replace" on a protected worksheet.
i saw this vba code online and it works.
But it has a problem, it will replace anything in the protected worksheet.
i want to allow user to perform this task only to certain range ( eg. D5:F20) in the worksheet.
Can this be achieve? thanks.
[vba]
Sub myReplace()
Dim What
Dim Replace
What = InputBox("What do you want to replace?:")
Replace = InputBox("Replace with what?:")
Cells.Replace _
What:=What, _
Replacement:=Replace, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _
SearchFormat:=False, _
ReplaceFormat:=False
End Sub
[/vba]
-
I've solved it, thanks.
Cells.Replace _
change to
Range("D5:F20").Replace _
[VBA]
Sub myReplace()
Dim What
Dim Replace
What = InputBox("What do you want to replace?:")
Replace = InputBox("Replace with what?:")
Range("D4:AG69").Replace _
What:=What, _
Replacement:=Replace, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _
SearchFormat:=False, _
ReplaceFormat:=False
End Sub
[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules