Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Do Loops Mike Excel Programming 0 August 29th 08 06:43 PM
CALLING A RANGE OF CELLS FROM EXTERNAL SOURCE Angelica Excel Discussion (Misc queries) 2 August 3rd 06 07:35 PM
calling up cells from a table. tanner Excel Worksheet Functions 5 May 17th 06 01:27 PM
SpinButton control loops infinitly when calling a ATL COM server [email protected] Excel Programming 0 March 16th 05 05:43 PM
calling cells from other sheets and listing louis2112 Excel Programming 3 April 19th 04 04:44 PM


All times are GMT +1. The time now is 06:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"