Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with for/next statements
I have this code that works
Sub NAMEINLAP1() Dim t As Integer With Worksheets("cardata1").Activate ActiveSheet.Range("a1:h500").Select For Each c In Selection.Columns(1).Range("a2:a20") If Not IsNumeric(c) Then c.Offset(, 1) = "IN LAP" Next End Sub However I want to loop it through 26 sheets in the format "cardata" & i so i tried this; Sub NAMEINLAP1() Dim t As Integer Dim i As Integer For i = 1 To 26 With Worksheets("cardata" & i).Activate ActiveSheet.Range("a1:h500").Select For Each c In Selection.Columns(1).Range("a2:a20") If Not IsNumeric(c) Then c.Offset(, 1) = "IN LAP" Nextc Next i End Sub However there is a problem with this. I guess it is to do with the double for/next statements but I am not sure of an alternative. Many thanks for your help. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF and THEN statements | Excel Discussion (Misc queries) | |||
the If Statements | Excel Worksheet Functions | |||
IF Statements (Mutliple Statements) | Excel Worksheet Functions | |||
IF Statements...I think | Excel Worksheet Functions | |||
operator statements, shorting when reusing one of the statements? | Excel Programming |