Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am looping through a macro, testing the contents a data
in column A. If I find a "P" in the first position clomun A, I want to capture the value, if there is one, in column C and column D in that row. I want to keep a running balance of the sum of those values by column. I am not sure how to reference those cells when I find a "P" in column A. Range("A1").Select For I = 1 to 100 If Left((ActiveCell,1)="P" Then TotalC = TotalC + ??? TotalD = TotalD + ??? How do I reference the cells in C and D to add the values to the running totals? Something like ActiveCell.Offset(0,2).Value? TIA. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Range("A1").Select For I = 1 to 100 With ActiveCell If Left((.Value,1)="P" Then TotalC = TotalC + .Offset(0,2).Value TotalD = TotalD + .Offset(0,3).Value .... End With -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Tim" wrote in message ... I am looping through a macro, testing the contents a data in column A. If I find a "P" in the first position clomun A, I want to capture the value, if there is one, in column C and column D in that row. I want to keep a running balance of the sum of those values by column. I am not sure how to reference those cells when I find a "P" in column A. Range("A1").Select For I = 1 to 100 If Left((ActiveCell,1)="P" Then TotalC = TotalC + ??? TotalD = TotalD + ??? How do I reference the cells in C and D to add the values to the running totals? Something like ActiveCell.Offset(0,2).Value? TIA. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro using a cell reference | Excel Discussion (Misc queries) | |||
absolute cell reference macro | Excel Discussion (Misc queries) | |||
Cell Reference Macro | Excel Discussion (Misc queries) | |||
cell reference in macro | Excel Discussion (Misc queries) | |||
run a macro from a cell reference | Excel Programming |