Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
try sub foo() dim rng as range dim cell as range set rng = Range("B2:B100") for each cell in rng if cell.calue = "SEL Book" then cell.offset(0,1).value = -1*cell.offset(0,1).value end if next end sub -- Regards Frank Kabel Frankfurt, Germany "CWit " schrieb im Newsbeitrag ... Hello I'm familiar with other code but I'm trying to learn the lingo of Excel/ VBA. I'm trying to write a condition statement that would allow me to scan column B2 down and search for "SEL Book" if it finds those words I would like it to change the corresponding number in Column C to a negative number. Logically put it would look like this. If B2 through B etc. = "SEL Book" then C etc. = negative number... Thanks for helping a Newbie! --- Message posted from http://www.ExcelForum.com/ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the quick response, the code works but it only allows on
number in column C to be negative at a time so say I have 25 rows i Column C with that condition only one converts to a negative number I'm trying to add all those numbers in Column C up so I need al corresponding cells to turn negative so my total is correct. Thank -- Message posted from http://www.ExcelForum.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
not sure I understand you but the code would change all entries in column C to a negative number if the adjacent cell in column B contains your criteria? -- Regards Frank Kabel Frankfurt, Germany "CWit " schrieb im Newsbeitrag ... Thanks for the quick response, the code works but it only allows one number in column C to be negative at a time so say I have 25 rows in Column C with that condition only one converts to a negative number. I'm trying to add all those numbers in Column C up so I need all corresponding cells to turn negative so my total is correct. Thanks --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Multiple condition if statement | Excel Discussion (Misc queries) | |||
IF statement...And condition | Excel Discussion (Misc queries) | |||
3 logical condition if statement | Excel Worksheet Functions | |||
Condition Statement | Excel Discussion (Misc queries) | |||
Condition Statement | Excel Programming |