Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
"Add/Remove Rows Code" adds rows on grouped sheets, but won't remove rows. | Excel Programming | |||
Effect of "Save As..." in making VBA code work, or not | Excel Programming | |||
Making "examp le" become "examp_le" in a string | Excel Programming | |||
Making command button code "more flexible" | Excel Programming | |||
Making command button code "more flexible" | Excel Programming |