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
 

Some videos you may like

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

HalfAce

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

Watch MrExcel Video

Forum statistics

Threads
1,118,436
Messages
5,572,099
Members
412,441
Latest member
kelethymos
Top