Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling cells in for-loops
whats the code that will allow me to select the row that the for loop is
currently on.. eg, if the loop starts at 1 goes to 5, and is currently working on row 2, i want to be using cell (column, 2) in my calcs.. thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling cells in for-loops
For lngRow = 1 to 5
Msgbox Cells(lngRow,1) Msgbox Range("A" & lngRow) Next If this post helps click Yes --------------- Jacob Skaria "Derrick" wrote: whats the code that will allow me to select the row that the for loop is currently on.. eg, if the loop starts at 1 goes to 5, and is currently working on row 2, i want to be using cell (column, 2) in my calcs.. thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling cells in for-loops
The answer depends on how your running your loop
It could be activecell.offset(,n) where n is the offset required from the current column or maybe c.offset(,n) If you post your code it will be easier to answer Mike "Derrick" wrote: whats the code that will allow me to select the row that the for loop is currently on.. eg, if the loop starts at 1 goes to 5, and is currently working on row 2, i want to be using cell (column, 2) in my calcs.. thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling cells in for-loops
First off, the property call you want is Cells (note the 's' at the end) and
you have the arguments reversed (row first, then column). Assuming your use of column is a stand-in for the actual column number or quoted letter, you would use your loop counter for the currently being processed row number. For example, if your loop counter were RowNumber, then your loop would be set up like this... For RowNumber = 1 To 5 ..... ValueInColumnBofCell = Cells(RowNumber, "B").Value ..... Next Now, of course, there are other considerations as well. For example, if you are referencing something other than the active worksheet, there would be references to that in the statement; but, in general, the above should get you started. -- Rick (MVP - Excel) "Derrick" wrote in message ... whats the code that will allow me to select the row that the for loop is currently on.. eg, if the loop starts at 1 goes to 5, and is currently working on row 2, i want to be using cell (column, 2) in my calcs.. thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Do Loops | Excel Programming | |||
CALLING A RANGE OF CELLS FROM EXTERNAL SOURCE | Excel Discussion (Misc queries) | |||
calling up cells from a table. | Excel Worksheet Functions | |||
SpinButton control loops infinitly when calling a ATL COM server | Excel Programming | |||
calling cells from other sheets and listing | Excel Programming |