Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I have the following macro which I wish to run everytime the contents of any cell is changed in the worksheet. Could someone please advise? Many thanks, Richard Thorneycroft Sub AutofitSelection() ' ' AutofitSelection Macro ' Macro recorded 25/01/2006 by RT ' ' Columns("A:F").Select Range("F1").Activate Selection.Columns.AutoFit Range("A2").Select End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code Private Sub Workbook_SheetActivate(ByVal Sh As Object) Columns("A:F").Select Range("F1").Activate Selection.Columns.AutoFit Range("A2").Select End Sub -- HTH Bob Phillips (remove nothere from email address if mailing direct) wrote in message oups.com... Hello, I have the following macro which I wish to run everytime the contents of any cell is changed in the worksheet. Could someone please advise? Many thanks, Richard Thorneycroft Sub AutofitSelection() ' ' AutofitSelection Macro ' Macro recorded 25/01/2006 by RT ' ' Columns("A:F").Select Range("F1").Activate Selection.Columns.AutoFit Range("A2").Select End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Oops that should be
Private Sub Workbook_SheetActivate(ByVal Sh As Object) sh.Columns("A:F")..AutoFit sh.Range("A2").Select End Sub -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Bob Phillips" wrote in message ... 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code Private Sub Workbook_SheetActivate(ByVal Sh As Object) Columns("A:F").Select Range("F1").Activate Selection.Columns.AutoFit Range("A2").Select End Sub -- HTH Bob Phillips (remove nothere from email address if mailing direct) wrote in message oups.com... Hello, I have the following macro which I wish to run everytime the contents of any cell is changed in the worksheet. Could someone please advise? Many thanks, Richard Thorneycroft Sub AutofitSelection() ' ' AutofitSelection Macro ' Macro recorded 25/01/2006 by RT ' ' Columns("A:F").Select Range("F1").Activate Selection.Columns.AutoFit Range("A2").Select End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet | Excel Programming | |||
How to end macro on inital active worksheet containing macro button that was clicked | Excel Programming | |||
How? Macro to copy range to new worksheet, name new worksheet, loop | Excel Programming | |||
macro to apply worksheet event to active worksheet | Excel Programming | |||
Record Worksheet Content as Macro and Execute from another Worksheet | Excel Programming |