0

so I tried the solutions here Excel ScreenUpdating False and still flickering screen but nth worked , im wondering if I should put the screen update in the fucntion I call Note that the function i call is gonna call another that'll parse data in the sheet once button 2 is clicked,Here's the code I did so far

Private Sub CommandButton2_Click()
    Application.ScreenUpdating = False
    ButtonOneClick = False
    Call SheetName
    If ButtonOneClick Then
        Me.CommandButton2.Visible = True
    Else
        Me.CommandButton2.Visible = False
    End If
    Application.ScreenUpdating = True
End Sub
  • @StureS why ? do u thinkk what i asked isnt clear ? too long ? – Chayma B's Apr 28 '21 at 14:07
  • @StureS I cant since im calling a function that calls another (it says code too long) plus even if u run it u wont have the sheets that im working with – Chayma B's Apr 28 '21 at 14:18
  • try turning screen updating off and on in the sub `SheetName` aswell – MGP Apr 28 '21 at 14:37
  • You could hide the button once clicked and when all operations are complete decide if it will be shown or not. Would this work? – Kostas K. Apr 28 '21 at 14:41
  • @MGP k I did that in both the subs that are called now the whole excel stopped flickering so its better but the button still does – Chayma B's Apr 28 '21 at 14:46
  • @KostasK. Thats exactly what I wanted to (clearly failed) cuz my goal was to make the button disappear once clicked (no need to see it parsing hundreds of lines) but I thought thats how we code it (sorry if the code is naive ) – Chayma B's Apr 28 '21 at 14:48
  • So, before you start the long operation, set its visibility to false followed by `DoEvents` to action it before the code jumps to the next line (single threaded). – Kostas K. Apr 28 '21 at 14:51
  • @KostasK. Amazing !! It worked thanks alot – Chayma B's Apr 28 '21 at 15:17

0 Answers0