Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
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 |
#2
![]() |
|||
|
|||
![]()
I think you have another response at your previous thread that will help.
(Not mine) Anthony wrote: 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 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
OsCommerce - Easy Populate Script - CSV/TXT Conversion Problem. | Excel Discussion (Misc queries) | |||
error in script from internet explorer | Excel Discussion (Misc queries) | |||
VBA script help..Please !!!! | Excel Discussion (Misc queries) | |||
Using a VB Script for barcodes - new to this | Excel Discussion (Misc queries) | |||
Macro script error - pls help !! | Excel Discussion (Misc queries) |