View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Loop Through Sheets, Copy/Paste if Match

After looking at it again, you probably want to exclude "Region" rather than
"Sheet1", although Region might be sheet 1. It will look for the tab name as
written and not the code name.

Sub chekB2()
Dim sh As Worksheet, c As Range
For Each sh In Worksheets
If LCase(sh.Name) < LCase("Region") Then
For Each c In Sheets("Region").Range("B2:B15")
If sh.Range("B2").Value = c.Value Then
MsgBox "Found"
Else
MsgBox "Not Found"
End If
Next
End If
Next
End Sub

"ryguy7272" wrote:

I am trying to come up with a way of looping through all B2 cells in all
sheets and comparing the value to the values in a variable range, such as
B2:B15, on a specific sheet named Region, and if there is a match, copy
paste the entire row (just one row) 2 lines below the match. Challenging?
Yes!! Possible? I don't know but I hope so!!



For next code below:

For Each sh In Worksheets
If LCase(sh.Name) < LCase("Sheet1") Then
sh.Activate
With

Stuff

End with

End If
Next sh
End Sub

Regards,
Ryan---


--
RyGuy