VB script help - please!!

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
 
D

Dave Peterson

I think you have another response at your previous thread that will help.

(Not mine)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top