Using the macro below:
Sub Ry()
Dim copyRange As Range, copyRange2 As Range, sh As Worksheet
Set copyRange = Sheets("Region Summary").Range("A1:O1")
Set copyRange2 = Sheets("Region Summary").Range("B2:B15")
copyRange.Copy
copyRange2.Copy
For Each sh In Worksheets
With sh
If .Name <> "Region Summary" And .Name <> "Rep Summary" Then
If WorksheetFunction.CountIf(copyRange2, _
..Range("B2")) > 0 Then
Sheets("Region Summary").Range("B2").Offset(2, 0).EntireRow.Copy
..Range("A65536") _
..End(xlUp).Offset(1, 0).PasteSpecial xlValues
If .Name <> "Region Summary" And _
..Name <> "Rep Summary" Then _
..Range("A65536").End(xlUp) _
..Offset(2, 0).PasteSpecial xlValues
End If
End If
End With
Next
Application.CutCopyMode = False
Set copyRange = Nothing
End Sub
Still encountering some weird behavior.
First, I wanted to copy/paste range A1:O1 from 'Region Summary' to each
sheet. then I wanted to bold this row (maybe fill the background as gray
too).
Second, I wanted to search through B2:B15 on 'Region Summary' and copy/paste
the matches to each respective sheet. The row three from 'Region Summary' is
always copied and pasted on each sheet. For instance, data for 'Frank' is
pasted into Frank's sheet, but also pasted to all other sheets.
Argh!! I guess with power comes complexity. VBA is powerful, and complex
too.
Any other thoughts JW?
Regards,
Ryan---
--
RyGuy
ryguy7272 said:
Sub CpyPst()
Dim sh As Worksheet, rgnRange As Range, lRow As Long
Set rgnRange = Sheets("Region Summary").Range("B2:B15")
For Each sh In Worksheets
With sh
If .Name <> "Region Summary" And .Name <> "Rep Summary" Then
If WorksheetFunction.CountIf(rgnRange, _
.Range("B2")) > 0 Then
.Range("B2").Offset(1, 0).EntireRow.Copy
.Range("A65536") _
.End(xlUp).Offset(2, 0).PasteSpecial xlValues
End If
End If
End With
Next
Set rgnRange = Nothing
End Sub
I modified this macro and now it does some weird stuff. ïŒ It copies the
3rd row from each sheet, goes to the bottom, back up to the used range,
offsets 2, and pastes it there. What I wanted to do was look at values in
Column B in each sheet (not named Region Summary or Rep Summary) and find
matches in Column B in the region Summary sheet, and then, if there is a
match, paste/special, go to the bottom, back up to the used range, offsets 2,
and pastes it there. But even before this, I wanted to copy/paste the range
form A1:O1 on Region Summary to each sheet not named Region Summary or Rep
Summary. Finally, I wanted to bold this range that is copied to each sheet.
It is easy to do when the rows are fixed, but I’m not sure how to do it when
the rows are variable.
Sorry about this guys. The loops always get me! I look forward to the day
that I can get them!!
I'll take a few more cracks at it, and try to resolve it on my own, but if
you have time JW, I'd be grateful if you could get back to me with the answer.
Regards,
Ryan---