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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,456
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.
 

marcs

Active Member
Joined
May 3, 2005
Messages
420
HalfAce

that's absolutely splendid, exactly what I was after

Many thanks

Heimir
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,001
Messages
5,834,820
Members
430,324
Latest member
bosphoruskid

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