Help with a macro

D

djohns158

I'm using Excel 2003. I am working in a master worksheet named "SHPG
RCVG RPT" which is on my desktop. After I enter all of the
information and create my hyperlinks, I need to protect the worksheet
and then save it to a different folder. The new name of the
worksheet
is determined by the purchase order # which is in cell D3. I need a
macro which will: Protect the worksheet --> Name the worksheet using
the purchase order # in D3 -->Save the worksheet in: F:\SHIPPING
RECEIVING REPORT. I can't do this using the macro recorder because
it
won't let me click on the cell in order to name it when saving. It
seems like it has to be written in VBasic, but I don't know the code.
I know it's probably very simple, but I don't know how to do it. Is
there anybody who can help?

Thank you


Daryl
 
L

Linda J

This should help with renaming the file.


Sub SaveClose()

' Saves file with current week in file name and closes file.

Dim StrFirst As String
With Worksheets("Sheet") ' this is the sheet your PO # is on
StrFirst = .Range("D5") ' this is the cell your PO # is in
End With

Application.DisplayAlerts = False

ActiveWorkbook.SaveAs _
"F:\Shipping Receiving Report\" & "MySheet_" & StrFirst, xlWorkbookNormal
' this will name the file "MySheet_0123.xls" (0123 being PO#)
 

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

Top