ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to copy 2 columns to new spreadsheet each new day (https://www.excelbanter.com/excel-programming/348423-macro-copy-2-columns-new-spreadsheet-each-new-day.html)

Joan[_3_]

Macro to copy 2 columns to new spreadsheet each new day
 
Hi,
Could anyone tell me how to write a macro that will automatically
copy two colums in an Excel worksheet and at the start of each day
insert them into a new worksheet with the new date on it? The columns

in the new worksheet are named differently than the previous day's
(i.e. Beginning bag count, instead of ending bag count). I've taken
a VB programming course but have not done any programming in Excel yet.

Any help with this would be most appreciated.


Joan


Tom Ogilvy

Macro to copy 2 columns to new spreadsheet each new day
 
Dim sh as Worksheet
set sh = Worksheets(Worksheets.count)
Worksheets.Add After:=sh
Worksheets(worksheets.count).Name = Format(date,"yyyymmdd")
sh.Range("A:B").Copy Worksheets(Worksheets.count).Range("A:B")
sh.Range("A1").Value = "Ending Bag Count"
sh.Range("B1").Value = "Ending Baggy Count"

--
Regards,
Tom Ogilvy

"Joan" wrote in message
oups.com...
Hi,
Could anyone tell me how to write a macro that will automatically
copy two colums in an Excel worksheet and at the start of each day
insert them into a new worksheet with the new date on it? The columns

in the new worksheet are named differently than the previous day's
(i.e. Beginning bag count, instead of ending bag count). I've taken
a VB programming course but have not done any programming in Excel yet.

Any help with this would be most appreciated.


Joan





All times are GMT +1. The time now is 12:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com