animating hide /unhide columns

marcs

Active Member
Joined
May 3, 2005
Messages
420
Is there a reasonably simple way of animating hide /unhide columns so that users can see what is happening, rather than the sudden jumping about which appears to happen?

All help appreciated
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Hello marcs,
I'm not sure what you mean by "animating hide /unhide columns", or by "the sudden jumping about".

Are you talking about having them slide in and out like you can do with a menu or something? (If so, then I don't know if it qualifies as being "reasonably simple", but you can try this in a standard module.)
Code:
Sub ShrinkColumns()
Dim x As Integer, wait As Double, go As Double
Dim ColWide
'(Change to the column(s) of choice and/or set to how wide your columns are)
ColWide = Columns("B:C").ColumnWidth
For x = ColWide To 0.1 Step -1
  With Columns("B:C")
    .ColumnWidth = x
    wait = 0.005
    go = Timer
    Do While Timer - go < wait
    Loop
  End With
Next x
End Sub




Sub GrowColumns()
Dim x As Integer, wait As Double, go As Double
For x = 0.1 To 15 '(Set to how wide you want the columns to get)
  With Columns("B:C") 'Change to the column(s) of choice
    .ColumnWidth = x
    wait = 0.005
    go = Timer
    Do While Timer - go < wait
    Loop
  End With
Next x
End Sub
It doesn't make them truly hidden (they're still 0.1 wide) but it makes them so at least the user can't see them.
Hope it helps.
 
Upvote 0
HalfAce

that's absolutely splendid, exactly what I was after

Many thanks

Heimir
 
Upvote 0

Forum statistics

Threads
1,214,632
Messages
6,120,652
Members
448,975
Latest member
sweeberry

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