I have a workbook with several sheets and I am trying to detect numbers in C9:C200 and copy them in a cell three columns over - for every sheet starting at the 7th. The code within the outermost forloop works fine on a single sheet but I get an error message when I try to loop it through the rest of the sheets. I think I have two problems:
-
I'm not sure how to bounce the c9:c200 range from sheet to sheet as it loops through the workbook
-
I think I need to tell VBA to reset the evaluations so that it starts from scratch on the next sheet.
Am I going in the right direction with this?
Thanks!
Sub MoveQtrLoop()
Dim CEL As Range
Dim RNG As Range
Dim I As Integer
Dim WrkSht As Worksheet
Dim WS_Count As Integer
I = 0
WS_Count = ActiveWorkbook.Worksheets.Count
For Each WrkSht In ActiveWorkbook.Worksheets
I = I + 1
If 6 < I < WS_Count Then
Set RNG = ActiveSheet.Range("c9:C200")
For Each CEL In RNG
If CEL.HasFormula = True Then
CEL.Offset(, 3) = CEL.Value
ElseIf IsNumeric(CEL) = True Then
CEL.Offset(, 3) = CEL.Value
Else
End If ****ERR. OCCURS HERE****
Next CEL
Else
End If
Next WrkSht
End Sub
Aucun commentaire:
Enregistrer un commentaire