Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub Save_to_root()
Dim fname dim cell as range With ActiveWorkbook for each cell in .Worksheets("Daily").Range("AH1:AH6").Cells if cell.Value<"" then fname = cell.Value & ".xls" .SaveAs fname end if next End With End Sub "Pam M" wrote in message ... I have a worksheet that needs to be saved in anywhere from 1 to 6 different locations depending on the contents of cells AH1 through AH6 (this is where the filenames are stored). I want the macro to save to all filenames in this range, but I don't want a runtime error when one of the cells is blank, for example if there are only 4 filenames instead of 6. Presently, my code is Sub Save_to_root() Dim fname With ActiveWorkbook fname = .Worksheets("Daily").Range("AH1").Value & ".xls" .SaveAs fname End With End Sub Can someone help with the adjustment? Thanks, Pam |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Trying to delete blank rows after file save | Excel Discussion (Misc queries) | |||
save file as different name until cell is blank | Excel Programming | |||
SAVE OR SAVE-AS with a file name derived from a cell on the spreadsheet... | Excel Programming | |||
save an excel file in fixed length records whose fields are blank | Excel Discussion (Misc queries) | |||
If a cell is blank do no let a user print or save? | Excel Worksheet Functions |