ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change CellA. (https://www.excelbanter.com/excel-programming/402075-change-cella.html)

Joergen Bondesen

Change CellA.
 
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

--

Best regards
Joergen Bondesen



joel

Change CellA.
 
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" wrote:

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

--

Best regards
Joergen Bondesen




Joergen Bondesen

Change CellA.
 
Hi Joel.

Thanks.

--

Best regards
Joergen Bondesen


"Joel" skrev i en meddelelse
...
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" wrote:

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

--

Best regards
Joergen Bondesen







All times are GMT +1. The time now is 04:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com