LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default How to update an entire column with IF statements in VBA

I am trying to do the following with 4 if statements to reflect the status of individual orders:

Column H = Quantity Start (manually entered)
Column P = Quantity Filled (manually entered)
Column S = Quantity Remaining (formula driven ie. Column H - P)
Column C = Status (formula driven by the 4 IF statements shown below)
Column O = Expiry Date (manually entered)

Column C is the dependent variable showing the status as to whether an order is (1)open; (2) filled; (3) partially
filled; or (4) expired/historical depending on what is entered in Column's H,O,P,S

Eg. Assume today is Jan. 25

(Status) (Quantity Start) (Expiry Date) (Quantity Filled) (Quantity Remaining)
Column C Column H Column O Column P Column S

Open 2000 Jan. 26 2000
Historical 2000 Jan.24 2000
Filled 5000 Jan. 25 5000 0
Partial 5000 Jan. 25 2000 3000
" " " " "
" " " " "
" " " " "
" " " "
" "

Note: mytime = now

I made it so orders expire at noon on the expiry date, i.e., change from open to historical if orders are not filled or
partially filled.

If Range("H" & Target.Row).Value = Range("P" & Target.Row).Value And _
Range("S" & Target.Row).Value = 0 Then
Range("C" & Target.Row).Value = "Filled"
ElseIf Range("H" & Target.Row).Value Range("P" & Target.Row).Value And _
Range("P" & Target.Row).Value < 0 Then
Range("C" & Target.Row).Value = "Partial"
ElseIf mytime Range("O" & Target.Row).Value + 0.5 And Range("P" & Target.Row).Value = 0 And _
Range("H" & Target.Row).Value = Range("S" & Target.Row).Value Then
Range("C" & Target.Row).Value = "Historical"
ElseIf Range("H" & Target.Row).Value = Range("S" & Target.Row).Value And _
Range("P" & Target.Row).Value = 0 Then
Range("C" & Target.Row).Value = "Open"
End If

The difficulty I'm having however is in getting the Status (Column C) for open orders to change to historical through
out the entire (Column C range) when the expiration date/time is elapsed.

Eg.1 Assume today is Jan. 25 at 11:30 am

(Status) (Quantity Start) (Expiry Date) (Quantity Filled) (Quantity Remaining)
Column C Column H Column O Column P Column S

Open 200 Jan. 25 200
Open 500 Jan. 25 500
Open 2000 Jan. 26 2000
Open 800 Jan. 25 800

Eg.2 Assume today is Jan. 25 at 12:01 pm (31 minutes later)

(Status) (Quantity Start) (Expiry Date) (Quantity Filled) (Quantity Remaining)
Column C Column H Column O Column P Column S

Historical 200 Jan. 25 200
Historical 500 Jan. 25 500
Open 2000 Jan. 26 2000
Historical 800 Jan. 25 800

Assume that one end user entered 4 orders (11:30 am) as in Eg. 1. Assume another end user is about to enter an
additional order (12:01 pm), how can I make the status change as in Eg. 2 when they click on any cell on the speadsheet.
In other words what I'm missing is what stimulates the entire C Column to accurately update all the status', just by
clicking on any cell.


Thank you in advance.

Susan


 
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
If data in one column, take date, add 2 days, and turn the entire column a color... [email protected] Excel Discussion (Misc queries) 6 August 24th 06 03:58 AM
my column is sorted in two sections. How do I sort entire column? Elcar Excel Discussion (Misc queries) 0 February 13th 06 08:41 PM
my column is sorted in two sections. How do I sort entire column? Bob Umlas, Excel MVP Excel Discussion (Misc queries) 0 February 13th 06 08:41 PM
How do I just update values on several cells (not the entire works Jeff Excel Programming 2 March 17th 05 04:53 AM
Auto update entire columns / rows??? Kcurtis Excel Worksheet Functions 3 February 3rd 05 10:45 PM


All times are GMT +1. The time now is 12:48 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"