xluser2007
02-07-2008, 08:08 PM
Hi All,
I am trying to write a relatively simple macro, but don;t know how to generalise it.
basically in a workbook, I want to select all worksheets (i.e. 'Shift + Tab' from first to last worksheet).
Then Select the entire worksheet (i.e. end up highlighting all possible active cells in the workbook).
Then do a simple replace of a number 200710 with 200711 (it is actually a folder reference that will change links faster than edit links if the workbooks are open).
I opened up a workbook and recorded the following macro:
Sub selectallwbks_then_Global_FINDreplace()
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
Sheets("Sheet1").Activate
Cells.Select
Selection.Replace What:="200710", Replacement:="200711", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub
How do I make sure I select all worksheets for any workbook i.e.e not using specific names in the Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select line?
Is there any way to do this simpler than the above process?
regards,
I am trying to write a relatively simple macro, but don;t know how to generalise it.
basically in a workbook, I want to select all worksheets (i.e. 'Shift + Tab' from first to last worksheet).
Then Select the entire worksheet (i.e. end up highlighting all possible active cells in the workbook).
Then do a simple replace of a number 200710 with 200711 (it is actually a folder reference that will change links faster than edit links if the workbooks are open).
I opened up a workbook and recorded the following macro:
Sub selectallwbks_then_Global_FINDreplace()
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
Sheets("Sheet1").Activate
Cells.Select
Selection.Replace What:="200710", Replacement:="200711", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub
How do I make sure I select all worksheets for any workbook i.e.e not using specific names in the Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select line?
Is there any way to do this simpler than the above process?
regards,