Stop Screen Flickering When Using Hide Rows Macro

andybason

Board Regular
Joined
Jan 7, 2012
Messages
178
Hello

I am using this macro via an activex checkbox. It works ok but the screen flickers whenever it is selected or deselected. By hiding a row I would have expected the rows below to move up but the issue here is that they seem to jump up but then jump back to the starting point.

VBA Code:
Private Sub CheckBox2_Click()

If CheckBox2 = False Then
[11:11].EntireRow.Hidden = True
Else:
[11:11].EntireRow.Hidden = False


End If
End Sub

I have tried using Application.ScreenUpdating but this doesn't make any difference.

Is there a way to stop this happening?

Thank you
 

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
48,400
Office Version
  1. 365
Platform
  1. Windows
That is just showing/hiding a single row & I don't get any screen flicker so I'm not sure what you have in your sheet/workbook that might cause annoyance flicker.

BTW, your code could also be written like this (with screenupdating off/on added before/after if you want)

VBA Code:
Private Sub CheckBox2_Click()
  Rows(11).Hidden = Not Rows(11).Hidden
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,127,442
Messages
5,624,800
Members
416,054
Latest member
Ariel2219

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