g48dd
Board Regular
- Joined
- Jan 12, 2009
- Messages
- 101
Excel 2003; I have two Macros in a SS that is full of data Web Query's that have to be refreshed once or twice daily. When the sheet updates it changes the column width and I have to reset column width for whole sheet so you can read it. I tried to just put the two together so that after the refresh data takes place then the sheet would just set its columns back to where they were. So I put call columnset into the Macro that handles the refresh. But what happens is the column set actually is running first even though it is at the end of the Refresh Macro. Which makes it useless. How do I change this?
As you can see the Macro for setting the column width was actually created first, then the Macro for refresh. However the Macro Refresh includes the Macro columnset.
Code:
Option Explicit
Sub ColumnSet()
'
' ColumnSet Macro
' Macro recorded 4/2/2011 '
'
Range("A:A,B:B,C:C").Select
Range("C1").Activate
Selection.ColumnWidth = 24
Range("D:D,E:E").Select
Range("E1").Activate
Selection.ColumnWidth = 6
Range("F:F,G:G").Select
Range("G1").Activate
Selection.ColumnWidth = 12
Range("H:H,I:I,J:J,K:K").Select
Range("K1").Activate
Selection.ColumnWidth = 6
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
Range("L:L,M:M").Select
Range("M1").Activate
Selection.ColumnWidth = 9
End Sub
___________________________________________________________
Sub Refresh()
'
' Refresh Macro
' Macro recorded 4/2/2011'
'
'
ActiveWorkbook.RefreshAll
Call ColumnSet
End Sub
As you can see the Macro for setting the column width was actually created first, then the Macro for refresh. However the Macro Refresh includes the Macro columnset.