C
Conan Kelly
Hello all,
If I run the following code on "grouped" sheets (more than one sheet
selected), the selected cells on ONLY the active sheet will be changed...all
other selected sheets will remain unchanged. If I were to change these
cells manually, all selected sheets will be changed.
Sub ReplaceReferences()
Dim prngCell As Range
Dim pbytNamedRange As Byte
Dim pbytIndex As Byte
pbytNamedRange = 1
pbytIndex = 1
For Each prngCell In Selection
prngCell.Formula = "'=" & Range("rngStartBals." &
pbytNamedRange).Cells(pbytIndex).Address(True, True, xlA1, True)
' ActiveWindow.SelectedSheets.prngCell.Formula = "'=" &
Range("rngStartBals." & pbytNamedRange).Cells(pbytIndex).Address(True, True,
xlA1, True)
pbytIndex = pbytIndex + 1
Next prngCell
End Sub
Is there some quick, simple way to get this to affect all selected sheets or
will I have to loop through all selected sheets and then loop through cells?
If looping through sheets then cells, no need to post modified code. I'm
pretty sure I can figure that out.
As you can tell by the commented-out line of code, I tried to qualify my
range variable with "ActiveWindow.SelectedSheets." and no workie. Hoping
for something simple like that, but will settle for looping through sheets
if necessary.
Thanks for any help anyone can provide,
Conan Kelly
If I run the following code on "grouped" sheets (more than one sheet
selected), the selected cells on ONLY the active sheet will be changed...all
other selected sheets will remain unchanged. If I were to change these
cells manually, all selected sheets will be changed.
Sub ReplaceReferences()
Dim prngCell As Range
Dim pbytNamedRange As Byte
Dim pbytIndex As Byte
pbytNamedRange = 1
pbytIndex = 1
For Each prngCell In Selection
prngCell.Formula = "'=" & Range("rngStartBals." &
pbytNamedRange).Cells(pbytIndex).Address(True, True, xlA1, True)
' ActiveWindow.SelectedSheets.prngCell.Formula = "'=" &
Range("rngStartBals." & pbytNamedRange).Cells(pbytIndex).Address(True, True,
xlA1, True)
pbytIndex = pbytIndex + 1
Next prngCell
End Sub
Is there some quick, simple way to get this to affect all selected sheets or
will I have to loop through all selected sheets and then loop through cells?
If looping through sheets then cells, no need to post modified code. I'm
pretty sure I can figure that out.
As you can tell by the commented-out line of code, I tried to qualify my
range variable with "ActiveWindow.SelectedSheets." and no workie. Hoping
for something simple like that, but will settle for looping through sheets
if necessary.
Thanks for any help anyone can provide,
Conan Kelly