More Visual Basic Syntax

A

Al

I need help figuring out the syntax for using the counter
from a 'For' loop in the cell references. I marked the
lines I have wrong w/ 'X'. Both errors involve passing
the value of 'counter' into a 'Range' statement to specify
the row number in a Cell designation.

Dim counter As Integer
Dim temp As String
For counter = 1 To 10
temp = Worksheets("Sheet1").Cells(counter, 1).Value
Select Case temp
Case apple
X Range("A'counter':H'counter'").Select
Selection.Copy
Sheets("Sheet2").Select
X Range("A'counter+43'").Select
ActiveSheet.Paste
Case ....
End Select
Next i
 
K

Kevin Stecyk

Al,

See below.

Regards,
Kevin
Dim counter As Integer
Dim temp As String
For counter = 1 To 10
temp = Worksheets("Sheet1").Cells(counter, 1).Value
Select Case temp
Case apple
Range("A" & counter & ":H" & counter).Select
Selection.Copy
Sheets("Sheet2").Select
Range("A" & counter+43 ).Select
ActiveSheet.Paste
Case ....
End Select
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

Similar Threads

How to hide password? 1
Can I send an email too? 3
help with a piece of code 5
Auto fill Sheets 1
Run Time Error 1004 7
Automatically selecting active chart 4
Do Until or For Loop 3
String search 1

Top