Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping through a column
Hi Its been a while since I've used excel and have a fairly easy question. I'm trying to loop through a column (C). This column has either the word 'surplus' or 'deficit' in each cell. If the word is deficit I would like to multiply the value in the preceeding col (B) by -1. Any ideas greatly appreciated. -- hudson40 ------------------------------------------------------------------------ hudson40's Profile: http://www.excelforum.com/member.php...o&userid=24681 View this thread: http://www.excelforum.com/showthread...hreadid=396105 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping through a column
Sub AA()
dim rng as Range, cell as Range set rng = Range(cells(1,"C"),cells(rows.count,"C").End(xlup) ) for each cell in rng if lcase(cell.value) = "deficit" then if isnumeric(cell.offset(0,-1)) then cell.offset(0,-1).value = cell.Offset(0,-1).value * (-1) end if end if Next End Sub -- regards, Tom Ogilvy "hudson40" wrote in message ... Hi Its been a while since I've used excel and have a fairly easy question. I'm trying to loop through a column (C). This column has either the word 'surplus' or 'deficit' in each cell. If the word is deficit I would like to multiply the value in the preceeding col (B) by -1. Any ideas greatly appreciated. -- hudson40 ------------------------------------------------------------------------ hudson40's Profile: http://www.excelforum.com/member.php...o&userid=24681 View this thread: http://www.excelforum.com/showthread...hreadid=396105 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
count rows in a column for looping | Excel Discussion (Misc queries) | |||
Looping until empty column | Excel Programming | |||
Looping until empty column | Excel Discussion (Misc queries) | |||
Multiple Column Cell Compare looping through Rows | Excel Programming | |||
looping from one column to the next | Excel Programming |