Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Condition Statement Help??

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Condition Statement Help??

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Condition Statement Help??

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
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
Multiple condition if statement Tel Excel Discussion (Misc queries) 4 June 25th 09 02:35 PM
IF statement...And condition Rich D Excel Discussion (Misc queries) 1 January 4th 08 03:50 PM
3 logical condition if statement Mikehughes Excel Worksheet Functions 3 July 19th 06 01:59 PM
Condition Statement Django Excel Discussion (Misc queries) 5 August 26th 05 06:59 PM
Condition Statement Stel Excel Programming 4 December 9th 03 12:52 PM


All times are GMT +1. The time now is 08:32 PM.

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

About Us

"It's about Microsoft Excel"