Column and row advance


J

JTWarthogs

I asked this earlier but it may not have been clear. To advance the rows in
a for statement is easy. So in the case below it is checking from A1 to A31
for the date and when it matches it copies over to the B and C columns.

So how do you check from columns B, C, D, E, and F? so I could do another
For/next statement inside to go from B to F so let column=a, then column =
column + ???? so that it goes to B, then cycles through the loop and goes to
C and so on until it cycles through 5 times 9 from B to F. I know that the +1
does not work so how can you cycle through letters?

Dim i As Integer
Let i = 1
For i = 1 To 31
If datecurrent = Worksheets("73-1 Data").Range("a" & i) Then
Worksheets("73").Range("b40").Copy Destination:=Worksheets("73-1
Data").Range("b" & i)
Worksheets("73").Range("b41").Copy Destination:=Worksheets("73-1
Data").Range("c" & i)
Worksheets("73").Range("b42").Copy Destination:=Worksheets("73-1
Data").Range("d" & i)
Worksheets("73").Range("b43").Copy Destination:=Worksheets("73-1
Data").Range("e" & i)
Worksheets("73").Range("b44").Copy Destination:=Worksheets("73-1
Data").Range("f" & i) Endif
Next i

Dim i As Integer
Let i = 1
For i = 1 To 31
If datecurrent = Worksheets("73-1 Data").Range("a" & i) Then
For column = 1 to 5
Worksheets("73").Range("b40").Copy Destination:=Worksheets("73-1
Data").Range(column & i)
column = column +1
Next column
Endif
Next i
 
Ad

Advertisements

J

JTWarthogs

I got it

Let i = 1
For i = 1 To 31
If datecurrent = Worksheets("73-1 Data").Range("a" & i) Then
For column = 2 To 6
Worksheets("73").Range("b40").Copy Destination:=Worksheets("73-1
Data").Cells(i, column)
Next column
Endif
Next i
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top