I'm trying to get screenupdating = false to work. I have an embedded form with ActiveX controls. The value of these controls is linked to various cells. I want updating to turn off, everything to execute, then updating turn back on so everything looks reset at the same time except in sequence. I have the following function:
I start with focus on the LinkTotalATaxes ActiveX textbox, with values only entered in the first 4 TextBoxes. When i execute the code, first I get the confirmation msg. When I click ok, this is what happens in order:
1. it appears the the screen is not updating because for a second there's nothing.
2. Suddenly all the numbers 1 to 10000 appear at the same time.
3. Focus moves to the first ActiveX control, LinkLocation.
4. LinkLocation is empties and then very shortly afer the other 3 textboxes empty at the same time
What is going on?!?!?! It's almost like my code is not executing in the order I wrote it. Also, screenupdating seems to work at first with outputting 1 to 10000 but then totally fails with the activeX controls.
Any help would be greatly appreciated. Thanks
Code:
Private Sub FinalizeButton_Click()
FinalizeButton.Shadow = True
Dim msgPrompt As String
Dim msgTitle As String
Dim confirmClick As Integer
msgPrompt = "Finalize Receipt?"
msgTitle = "Clicked Finalize"
confirmClick = MsgBox(msgPrompt, vbYesNo + vbQuestion, msgTitle)
If confirmClick = vbYes Then
If inputErrorFlag = False Then 'it is always false
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Range("LinkLocation").Value = "" 'reset location
'don't reset date month, day, or year
Range("LinkNotes").Value = "" 'reset notes
Range("LinkTotalBTaxes").Value = "" 'reset total before taxes
Range("LinkTotalATaxes").Value = "" 'reset total after taxes
ActiveSheet.OLEObjects("Location").Activate
Dim y As Integer
For y = 1 To 10000
Range("p1").Offset(y - 1, 0).Value = y
Next y
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Else
'do nothing because there's an error
End If
End If
FinalizeButton.Shadow = False
End Sub
1. it appears the the screen is not updating because for a second there's nothing.
2. Suddenly all the numbers 1 to 10000 appear at the same time.
3. Focus moves to the first ActiveX control, LinkLocation.
4. LinkLocation is empties and then very shortly afer the other 3 textboxes empty at the same time
What is going on?!?!?! It's almost like my code is not executing in the order I wrote it. Also, screenupdating seems to work at first with outputting 1 to 10000 but then totally fails with the activeX controls.
Any help would be greatly appreciated. Thanks