Task that Copy data to new workbook multiple times a day; need help with naming new sheet

mikeHunt

New Member
Joined
Jul 16, 2018
Messages
5
So I am working on a project to automate the pull of data from my companies website. I have figured out how to do the majority of the project; I am having trouble when I have to name the new sheet to write the data to. my code is as follows..

With y.Sheets("Sheet1").Range("A1")
.PasteSpecial x1PasteFormats
.PasteSpecial x1PasteValues
end With

What can I do so I do not have to go make a sheet named "Sheet1" every time the program runs. It would be dope if the sheet name could be the date and time. Any Help Would be Great
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi & welcome to the board.
How about
Code:
y.Sheets.Add.name = format(Now, "dd-mm-yyyy hh-mm-ss")
With ActiveSheet.Range("A1")
   .PasteSpecial xlPasteFormats
   .PasteSpecial xlPasteValues
End With
 
Upvote 0
You can use a macro to add the sheet and name it.
Code:
Sub AddSht()
    Dim d As String
    d = Format(Now, "MM-DD-YY_hh-mm-ss")
    Sheets.Add.Name = d
End Sub
 
Last edited:
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top