Looping
Posted by Sid on October 18, 2001 12:42 AM
Hi, I am trying to condense the code below by looping the if statement. Also I need to return to the active cell on the sheet that calls this macro
Mysearch ()
Dim Sht As Worksheet
Dim sCurrentSheet As String
sCurrentSheet = ActiveSheet.Name
For Each Sht In Application.Worksheets
Sht.Activate
sCurrentSheet = ActiveSheet.Name
FinalRow = Range("b65536").End(xlUp).Row
For x = 3 To FinalRow
-values defined here-
If -numerous value definitions here-And positionvalue = "A**" Then
Range("b" & x).Copy
Sheets("positions").Select
NextRow = Range("a**65536").End(xlUp).Row + 1
Range("A**" & NextRow).Select
ActiveSheet.Paste
Sheets(sCurrentSheet).Select
End If
If -repeat above with **changed to B,
etc
Next x
End If
Next Sht
-Code to go to inital sheet/activecell that called this sub
End Sub
The loop would need to change the letters marked ** above from A thro' to Z
Thanx Sid