duplicating macros

  • Thread starter Thread starter Sheetal
  • Start date Start date
S

Sheetal

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
 
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")
 
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
 
The errors were just runtime errors, but I have fixed them now. Than
so much for your help!!

Regards,
Sheeta
 
Back
Top