View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
moike[_2_] moike[_2_] is offline
external usenet poster
 
Posts: 1
Default VB Code is working for row1; how to apply to row2?


Bearacade Wrote:
Without seeing your codes and exactly what you are doing, it hard to say
what you need to do.

Most likely a loop would help you run the macro thru all the neccessary
rows.

You might need to include examples to make it more clear


Sure,

Here is more info about what I am doing.

Structure of the spreadsheet: Column C has a dollar amount, Column D
has a date, column F has the term of the contract in months, columns G
through Q are fiscal quarters.

I need the macro to first verify if the amount in column C is or <
than 100k.

If less than 100k; the full value of column C will be entered in
whichever fiscal quarter includes the date of 1 month beyond the date
of column D.

If the amount in C is greater than 100k; the value of column C must be
divided by the number of months in the contract which is reflected in
column F. This new amount must be entered in columns G through Q
(fiscal quarters) but it can't start until 1 month after the date in
column D.

Anyway, I have working code to do this in the first row but my code
contains the cell locations associated with the first row. I need the
code to continue through all rows with the same steps using the values
on that row.

Are there other ways to signify which cells I want to include in my
code other than calling out the location (ie: A1,A2)? I guess I could
use:

Range("A1").Select
ActiveCell.FormulaR1C1 = "=RC[+1]"

and continue with that format for the rest of the steps so that the
only time I call out a specific location would be the "A1" at the
beginning. That would require me to use the same code over and over in
the macro but keep changing the A1 to A2,A3, etc.

Is there an easier way (maybe a loop) to tell the macro where to start
and then to move to the next row once finished with all the steps I
outlined?


--
moike
------------------------------------------------------------------------
moike's Profile: http://www.excelforum.com/member.php...o&userid=37668
View this thread: http://www.excelforum.com/showthread...hreadid=572754