Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get value form a cell in a loop
I collect a variable column from a messge box:
st = InputBox("Insert column to start") and I then want to get the value for a range of cells in this column and subsequent work on them, all in a loop (where lastrow has been determined elsewhere) For irow = 2 to lastrow v1 = (st & ":" & irow ).value .................... Next irow This fails as the range has too many " in it. How do I express a range when I have the column as st (assume st ="C") and the row as irow (assume irow=2). Thanks, Kanga85 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get value form a cell in a loop
try this line instead
v1 = Range(st & irow).Value you don't need the ":" for a single cell -- Gary "Kanga 85" wrote in message ... I collect a variable column from a messge box: st = InputBox("Insert column to start") and I then want to get the value for a range of cells in this column and subsequent work on them, all in a loop (where lastrow has been determined elsewhere) For irow = 2 to lastrow v1 = (st & ":" & irow ).value .................... Next irow This fails as the range has too many " in it. How do I express a range when I have the column as st (assume st ="C") and the row as irow (assume irow=2). Thanks, Kanga85 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get value form a cell in a loop
Thanks Gary,
Kanga85 "Gary Keramidas" wrote: try this line instead v1 = Range(st & irow).Value you don't need the ":" for a single cell -- Gary "Kanga 85" wrote in message ... I collect a variable column from a messge box: st = InputBox("Insert column to start") and I then want to get the value for a range of cells in this column and subsequent work on them, all in a loop (where lastrow has been determined elsewhere) For irow = 2 to lastrow v1 = (st & ":" & irow ).value .................... Next irow This fails as the range has too many " in it. How do I express a range when I have the column as st (assume st ="C") and the row as irow (assume irow=2). Thanks, Kanga85 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get value form a cell in a loop
I have now found that:
value1=Cells(Row,Column).value is the correct syntax. i.e. Row before Column Kamga85 "Kanga 85" wrote: I collect a variable column from a messge box: st = InputBox("Insert column to start") and I then want to get the value for a range of cells in this column and subsequent work on them, all in a loop (where lastrow has been determined elsewhere) For irow = 2 to lastrow v1 = (st & ":" & irow ).value .................... Next irow This fails as the range has too many " in it. How do I express a range when I have the column as st (assume st ="C") and the row as irow (assume irow=2). Thanks, Kanga85 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I fill a cell in a user form from a selection on same form? | Excel Discussion (Misc queries) | |||
Stopping repetitive loop execution through user form (or other ide | Excel Programming | |||
how to choose random namber form loop? | Excel Programming | |||
Is it possible to open the VBA form with a link in a sheet and to pass variable from a cell to the VBA form? | Excel Programming | |||
loop through form objects | Excel Programming |