Wait Until

ddub25

Well-known Member
Joined
Jan 11, 2007
Messages
586
I am using a 'Private Sub Worksheet_Change' and a part of the code is below.

Code:
If Range("A1").Value = 1, Then
     Range("A2").Value = "Yes"

I want to adapt this code to be able to wait until A1 = 1, then execute, Range("A2").Value = "Yes"

How can I do this?
 

Some videos you may like

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,916
Office Version
  1. 365
Platform
  1. Windows
Not sure what you mean.

How is A1 being populated/changed?
Is it hard-coded or is it a formula?
If a formula, what is the formula?

It might also be helpful to post the entire VBA Procedure.
 

jimrward

Well-known Member
Joined
Feb 24, 2003
Messages
1,784
Office Version
  1. 2016
  2. 2013
  3. 2011
  4. 2010
  5. 2007
Platform
  1. Windows
Surely the worksheet change event takes care of that, if A1 not equal to 1 then exit else perform your task
 
Last edited:

ddub25

Well-known Member
Joined
Jan 11, 2007
Messages
586
Here is the relevant sequence of code. There are quite a few more lines of code, so cannot post the entire 'Private Sub Worksheet_Change'. I have highlighted the part where I want the code to WAIT UNTIL... in Italics.

A1 is being populated by an external program.

Code:
'System 1, is Trade Entry opportunity present? If so, go through process of Entering trade
If Range("Sys1_TradeEntry").Value = "Yes" And Range("Sys1_EntStatus").Value <> "Placed" Then
    If Range("Sys1_Player") = "Player1" Then
        Range("ExeBL_P1").Value = Range("Sys1_EntBetType").Value
        Range("ExeStake_P1").Value = Range("Sys1_EntStake").Value
            'If Range("Sys1_EntBetType).Value = "Lay" Then
                Range("ExeOdds_P1").Value = Range("P1Curr_LayOddsC").Value
            Else
                Range("ExeOdds_P1").Value = Range("P1Curr_BackOddsC").Value
            End If                
                [I]'WAIT UNTIL Range("ExeStatus_P1").Value = "PLACED", Then[/I]
                        Range("Sys1_EntStatus") = "Placed"
                        Range("Sys1_EntBetRef") = Range("BetRef_P1")
                        'Enter System Number and System Description in Bet Records Log
                        'Reference Odds Matched from Bet Records output, enter in Odds Matched column
                        'Reference Stake Matched from Bet Records output, enter in Stake Matched column
                        Range("ExeRange_P1").ClearContents
    End If
En If
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,916
Office Version
  1. 365
Platform
  1. Windows
Please answer all the questions I posted up in my first reply, in regards to this Range("ExeStatus_P1") range.
Those are important details that will help determine how to write the code.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,517
Messages
5,596,619
Members
414,081
Latest member
Subaru_Steve

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top