![]() |
Replace fuction replacing all instead of selected cells
I have this code in a macro:
Sheets("Sheet 1").Select For j = 9 To 39 Cells(j, "A").Replace What:="/", Replacement:="¦" Cells(j, "A").Replace What:="\", Replacement:="|" Cells(j, "A").Replace What:="[", Replacement:="€¹" Cells(j, "A").Replace What:="]", Replacement:="€º" Next j The problem is instead of only looking in cells A9 to A39 in Sheet 1 for these characters to replace the macro looks in ALL cells in ALL sheets in the workbook! Why is this? Thanks Clayton |
Replace fuction replacing all instead of selected cells
Found out why this is happening. In excel if I select Edit|Replace, Options
and I change the "Within" field from Workbook to Sheet the below works. Is there a way to force "Within" to be Sheet in Vb? "mcphc" wrote: I have this code in a macro: Sheets("Sheet 1").Select For j = 9 To 39 Cells(j, "A").Replace What:="/", Replacement:="¦" Cells(j, "A").Replace What:="\", Replacement:="|" Cells(j, "A").Replace What:="[", Replacement:="€¹" Cells(j, "A").Replace What:="]", Replacement:="€º" Next j The problem is instead of only looking in cells A9 to A39 in Sheet 1 for these characters to replace the macro looks in ALL cells in ALL sheets in the workbook! Why is this? Thanks Clayton |
All times are GMT +1. The time now is 03:59 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com