slayer1957
Board Regular
- Joined
- Jan 9, 2017
- Messages
- 50
Hi all,
I need to just add todays date and cell value "S2" to my current code below. I have small section to add but cannot get it right and cell value still also needs to be added. Can someone please help.
I need to just add todays date and cell value "S2" to my current code below. I have small section to add but cannot get it right and cell value still also needs to be added. Can someone please help.
Code:
_" & _Format(Date, "ddmmmyyyy") & Cell.value "S2" & ".xlsm"
VBA Code:
Sub EXPORT()
Dim mySourceWB As Workbook
Dim mySourceSheet As Worksheet
Dim myDestWB As Workbook
Dim myNewFileName As String
' First capture current workbook and worksheet
Set mySourceWB = ActiveWorkbook
Set mySourceSheet = ActiveSheet
' Build new file name based
myNewFileName = mySourceWB.Path & "\" & mySourceSheet.Name & ".xlsx"
' Add new workbook and save with name of sheet from other file
Workbooks.Add
ActiveWorkbook.SaveAs Filename:=myNewFileName
Set myDestWB = ActiveWorkbook
' Copy over sheet from previous file
mySourceWB.Activate
Cells.Copy
myDestWB.Activate
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
' Resave new workbook
ActiveWorkbook.Save
End Sub