ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Help with a macro (https://www.excelbanter.com/excel-worksheet-functions/210048-help-macro.html)

[email protected]

Help with a macro
 
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



Linda J[_2_]

Help with a macro
 

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#)

" wrote:

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





All times are GMT +1. The time now is 04:45 PM.

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