Change CellA.

  • Thread starter Joergen Bondesen
  • Start date
J

Joergen Bondesen

Hi NG

I have this macro [simplified]

Sub test()

dim RRange as range
set RRange=Range("A1:A1000")

dim CellA as range
'// Loop 1
for each CellA in RRange
'// CellA = Range("A1")

'// Loop2
dim CellA2 as range
for each CellA2 in rrange.offset(1,0)
'// doing something and now I want CellA to continue with
Range("A10"),
'// I will use a counter and Cells(counter,1)
'// Is it possible, and how ?

'// Next time in loop2 I want CellA=Range("A25")
exit for
next cellA2

'// something like: CellA=Range("A10")
next CellA
 
J

Joel

I think your codde would be better structuresd like this

RowCountColA = 1
do while RowCountColA <= 1000
CellA = Range("A" & RowCountColA)
RowCountColB = 1
do while RowCountColB <= 1000
CellB = Range("B" & RowCountColB)
RowcountColB = RowCountColB + 1
loop
RowcountColA = RowCountColA + 1
loop
 
J

Joergen Bondesen

Hi Joel.

Thanks.

--

Best regards
Joergen Bondesen


Joel said:
I think your codde would be better structuresd like this

RowCountColA = 1
do while RowCountColA <= 1000
CellA = Range("A" & RowCountColA)
RowCountColB = 1
do while RowCountColB <= 1000
CellB = Range("B" & RowCountColB)
RowcountColB = RowCountColB + 1
loop
RowcountColA = RowCountColA + 1
loop


Joergen Bondesen said:
Hi NG

I have this macro [simplified]

Sub test()

dim RRange as range
set RRange=Range("A1:A1000")

dim CellA as range
'// Loop 1
for each CellA in RRange
'// CellA = Range("A1")

'// Loop2
dim CellA2 as range
for each CellA2 in rrange.offset(1,0)
'// doing something and now I want CellA to continue with
Range("A10"),
'// I will use a counter and Cells(counter,1)
'// Is it possible, and how ?

'// Next time in loop2 I want CellA=Range("A25")
exit for
next cellA2

'// something like: CellA=Range("A10")
next CellA
 

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