

July 19, 2019

Hi,
I have one macro where i want to run the macro with save button instead of clicking "Run button" every time.
Below is my very small coding, i want to add some coding to run the macro whenever i save the file (Ctrl+S).
Sub Numberformat()
'
' Numberformat Macro
'
Columns("J:M").Select
Selection.Numberformat = "General"
Columns("J:J").Select
Selection.TextToColumns Destination:=Range("J1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 2), TrailingMinusNumbers:=True
End Sub


October 5, 2010

Hi Rafi,
Use a Workbook_BeforeSave event
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
<< YOUR CODE GOES HERE >>
End Sub
This code will go in the ThisWorkbook module of your workbook - see attached.
Regards
Phil
1 Guest(s)
