G
Guest
Linked to my previous question.........
I have this code below which once run creates a new worksheet (which is a
copy of my 'Log Master') - 2 problems.....
1 the script creates a copy of the Log Master sheet and renames it Log
Master1, Log Master2 etc and also crteats a blank sheet ie 'sheet1' , 'sheet2'
2 I want the newly created sheet to be renamed with todays date
my code
Sub Create_log()
Dim shtNew As Worksheet
Dim shtTest As Worksheet
Dim strNewName As String
Dim shtExist As Boolean
shtExist = False
strNewName = CStr(Day(Date)) & " " & CStr(Format$(Date, "mmmm"))
For Each shtTest In ActiveWorkbook.Worksheets
If shtTest.Name = strNewName Then
shtExist = True
End If
Next shtTest
If Not shtExist Then
Set shtNew = Worksheets.Add
Sheets("Log master").Visible = True
Sheets("Log Master").Copy After:=ActiveSheet
'ActiveSheet.Name =
Sheets("Log Master").Visible = False
End If
End Sub
Many thanks for your help - and go easy - I'm new to this
I have this code below which once run creates a new worksheet (which is a
copy of my 'Log Master') - 2 problems.....
1 the script creates a copy of the Log Master sheet and renames it Log
Master1, Log Master2 etc and also crteats a blank sheet ie 'sheet1' , 'sheet2'
2 I want the newly created sheet to be renamed with todays date
my code
Sub Create_log()
Dim shtNew As Worksheet
Dim shtTest As Worksheet
Dim strNewName As String
Dim shtExist As Boolean
shtExist = False
strNewName = CStr(Day(Date)) & " " & CStr(Format$(Date, "mmmm"))
For Each shtTest In ActiveWorkbook.Worksheets
If shtTest.Name = strNewName Then
shtExist = True
End If
Next shtTest
If Not shtExist Then
Set shtNew = Worksheets.Add
Sheets("Log master").Visible = True
Sheets("Log Master").Copy After:=ActiveSheet
'ActiveSheet.Name =
Sheets("Log Master").Visible = False
End If
End Sub
Many thanks for your help - and go easy - I'm new to this