Excel VBA Prob-Macro Help

  • Thread starter Thread starter madmatt
  • Start date Start date
M

madmatt

I need a macro which will hide the whole column 'A' then Save using thi
code:

Sub save()
Dim fname
fname = Worksheets("sheet1").Range("A1").Value & Format(Now
"_DD_MM_YYYY_HH_MM_SS")
fname = fname & ".xls"
ActiveWorkbook.SaveAs Filename:=fname
End Sub

(that works i have checked)

Then Print the only 'One Page' of the sheet, Then Copy The Printe
sheet and open up a new workbook and copy the whoile of the last wor
book (which contains 3 sheets) to the new on e to start over again
Many Thanks
Mat
 
Hi
for the first questions try the following (not fully tested):
Sub save()
Dim fname
Worksheets("sheet1").Range("A:A").hidden = true
fname = Worksheets("sheet1").Range("A1").Value & Format(Now,
"_DD_MM_YYYY_HH_MM_SS")
fname = fname & ".xls"
ActiveWorkbook.SaveAs Filename:=fname
Worksheets("sheet1").printout (From:=1, to:=1)
End Sub


For the rest of your question I'm not quite sure I understood
everything (but that's maybe just beacuse it's getting late...)
 
No, i did'nt work for me, the last part was i want to copy the workboo
so after its saved a printed i will be copied to a new workbook an
more ideas??
Many Thanks Mat
 
Hi Matt
what does 'didn't work for me' mean :-)
- compiler error
- wrong result
- etc.
 
well,
line
fname = Worksheets("sheet1").Range("A1").Value & Format(Now,
"_DD_MM_YYYY_HH_MM_SS")
and
Worksheets("sheet1").printout (From:=1, to:=1)
are in red

and it says compile error- syntax error
on the first line#:
fname = Worksheets("sheet1").Range("A1").Value & Format(Now,
"_DD_MM_YYYY_HH_MM_SS"
 
Hi
1. the lines
fname = Worksheets("sheet1").Range("A1").Value & Format(Now,
"DD_MM_YYYY_HH_MM_SS")

is just one line. Please remove the linebreak or insert the following:
fname = Worksheets("sheet1").Range("A1").Value _
& Format(Now,"DD_MM_YYYY_HH_MM_SS")

2. Worksheets("sheet1").printout (From:=1, to:=1)
my fault. make this
Worksheets("sheet1").printout From:=1, to:=1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top