LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 419
Default Making changes on "grouped" sheets via code

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Add/Remove Rows Code" adds rows on grouped sheets, but won't remove rows. Conan Kelly Excel Programming 1 November 16th 07 10:41 PM
Effect of "Save As..." in making VBA code work, or not David J Richardson[_2_] Excel Programming 0 October 24th 07 12:03 PM
Making "examp le" become "examp_le" in a string Sworkhard Excel Programming 3 October 29th 04 09:31 PM
Making command button code "more flexible" John Wilson Excel Programming 1 August 4th 03 10:43 PM
Making command button code "more flexible" Greg Wilson[_3_] Excel Programming 0 August 4th 03 06:12 PM


All times are GMT +1. The time now is 05:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"