View Single Post
  #2   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

Hi Ryan, I did not test this so, it might hiccup, but the basic are there.

Sub chekB2()
Dim sh As Worksheet, c As Range
For Each sh In Worksheets
If LCase(sh.Name) < LCase("Sheet1") 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