duplicating macros
This is the code for my macro: Windows("dump.xls").Activate Cells.Replace What:="$", Replacement:="", LookAt:=xlPart SearchOrder:= _ xlByRows, MatchCase:=False Cells.Select ActiveWindow.Zoom = 75 Columns("A:A").Select Selection.Copy Windows("New_format_PL_101103_test.xls").Activate Range("A1").Select ActiveSheet.Paste Windows("dump.xls").Activate Columns("B:D").Select Application.CutCopyMode = False Selection.Copy Windows("New_format_PL_101103_test.xls").Activate Range("C1").Select ActiveSheet.Paste Windows("dump.xls").Activate As you can see, it copies information from one page and pastes it int another. my problem is, how can I replicate this macro without havin the names of the files in there. I plan to make a new document b copying new_format_pl_101103.xls everyday, and renaming it, so today this document is called new_format_pl_111103.xls. I don't want to hav to go into the code everyday so that my macro can be run. Please help me. Thanks Sheeta ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
duplicating macros
Hi Sheetal
Sub test() Dim Dayfile As String Dayfile = "New_format_pl_" & _ Format(Date, "ddmmyy") & ".xls" MsgBox Dayfile End Sub As you hopefully know; To use a string variable as that, do not put quotes around it: Windows(Dayfile) NOT Windows("Dayfile") -- HTH. Best wishes Harald Followup to newsgroup only please. "Sheetal" wrote in message ... This is the code for my macro: Windows("dump.xls").Activate Cells.Replace What:="$", Replacement:="", LookAt:=xlPart, SearchOrder:= _ xlByRows, MatchCase:=False Cells.Select ActiveWindow.Zoom = 75 Columns("A:A").Select Selection.Copy Windows("New_format_PL_101103_test.xls").Activate Range("A1").Select ActiveSheet.Paste Windows("dump.xls").Activate Columns("B:D").Select Application.CutCopyMode = False Selection.Copy Windows("New_format_PL_101103_test.xls").Activate Range("C1").Select ActiveSheet.Paste Windows("dump.xls").Activate As you can see, it copies information from one page and pastes it into another. my problem is, how can I replicate this macro without having the names of the files in there. I plan to make a new document by copying new_format_pl_101103.xls everyday, and renaming it, so today, this document is called new_format_pl_111103.xls. I don't want to have to go into the code everyday so that my macro can be run. Please help me. Thanks Sheetal ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ |
duplicating macros
I put the command you gave me into my code, and took out the quotatio marks, but my code is still coming up with errors. The dates that I a working with, are 1 day behind. how can i sort this out? Thank you so much for your hel ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
duplicating macros
What errors ? What do they say ?
For yesterday: Format(Date - 1, "ddmmyy") -- HTH. Best wishes Harald Followup to newsgroup only please "Sheetal" skrev i melding ... I put the command you gave me into my code, and took out the quotation marks, but my code is still coming up with errors. The dates that I am working with, are 1 day behind. how can i sort this out? Thank you so much for your help ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ |
duplicating macros
The errors were just runtime errors, but I have fixed them now. Than so much for your help!! Regards, Sheeta ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
All times are GMT +1. The time now is 03:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com