I have made a few changes to try and fix this so will try to explain, but excel comes up with big error screen and has to close.
In AB2 i had a code that compared the count down clock in BA with a predefined time i wanted to update the prices, 30 minutes before the start so i could load it all up in the morning and leave it.
As you know i am using 1 workbook for each venue, originaly i had a formula to populate AB2 with a 1 when 30 minutes was hit, i have since changed this and put that in the macro i have also stopped calling another macro and made the code simpler.
current code minus the section that causes errors
- Code: Select all
Private Sub Worksheet_Calculate()
Static MyMarket As Variant
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
With ThisWorkbook
If [A1].Value = MyMarket Then
GoTo Xit
Else
MyMarket = [A1].Value
.Sheets("Venue").Range("Z5:Z44").Value = ""
.Sheets("Venue").Range("Z5:Z44").Value = .Sheets("Venue").Range("AA5:AA44").Value
End If
End With
Xit:
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End Sub
As soon as i add anything like the below code it crashes, it is always the same thing the code works good until the 30 minute then crash, do i need to use the Worksheet_Calculate or is there another option that will update my prices when the race changes and at the 30 minute mark
- Code: Select all
Private Sub Worksheet_Calculate()
Static MyMarket As Variant
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
With ThisWorkbook
IF .Sheets("Venue").Range("Z5:Z44").Value = ""
.Sheets("Venue").Range("Z5:Z44").Value = .Sheets("Venue").Range("AA5:AA44").Value
Else
If [A1].Value = MyMarket Then
GoTo Xit
Else
MyMarket = [A1].Value
.Sheets("Venue").Range("Z5:Z44").Value = ""
.Sheets("Venue").Range("Z5:Z44").Value = .Sheets("Venue").Range("AA5:AA44").Value
End If
End If
End With
Xit:
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End Sub