Hi!
Just recorded my very first macro (yay!). It's a simple one doing mainly sorting and copying. I'm missing some functionality though that might not be possible to record, however could perhaps be modified within the VBA code?
The file is template.xlsm - given it's a template in nature, I want to minimize the risk users would make and save changes to it, so I want to include the "Save As" process in the macro. I did not try recording a "Save As" function in the macro as I don't know how to choose a proper file name, as the template file itself should not be overwritten. I have 2 options for file name selection:
1. Use a timestamp for file name (doesn't really matter on the date format)
2. Use contents of a pre-defined cell in the file (e.g. "C2")
3. IDEALLY BOTH
Can the same VBA code I recorded be adjusted to also include this? The folder path for the new file should be the same with template.
Thanks a bunch in advance!
Just recorded my very first macro (yay!). It's a simple one doing mainly sorting and copying. I'm missing some functionality though that might not be possible to record, however could perhaps be modified within the VBA code?
The file is template.xlsm - given it's a template in nature, I want to minimize the risk users would make and save changes to it, so I want to include the "Save As" process in the macro. I did not try recording a "Save As" function in the macro as I don't know how to choose a proper file name, as the template file itself should not be overwritten. I have 2 options for file name selection:
1. Use a timestamp for file name (doesn't really matter on the date format)
2. Use contents of a pre-defined cell in the file (e.g. "C2")
3. IDEALLY BOTH
Can the same VBA code I recorded be adjusted to also include this? The folder path for the new file should be the same with template.
Thanks a bunch in advance!
Code:
Sub Template()
'
' Template Macro
'
' Keyboard Shortcut: Ctrl+q
'
Columns("E:E").Select
Selection.EntireColumn.Hidden = False
Columns("D:D").Select
Selection.EntireColumn.Hidden = False
ActiveSheet.Range("$A$3:$H$289").AutoFilter Field:=6, Criteria1:="<>"
Application.Goto Reference:="Template"
Selection.Copy
Columns("D:D").Select
Selection.EntireColumn.Hidden = True
Columns("E:E").Select
Selection.EntireColumn.Hidden = True
End Sub