Wait Until

ddub25

Well-known Member
Joined
Jan 11, 2007
Messages
617
Office Version
  1. 2019
Platform
  1. Windows
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?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
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.
 
Upvote 0
Surely the worksheet change event takes care of that, if A1 not equal to 1 then exit else perform your task
 
Last edited:
Upvote 0
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
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,213,565
Messages
6,114,337
Members
448,568
Latest member
Honeymonster123

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
Back
Top