View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bielle Bielle is offline
external usenet poster
 
Posts: 2
Default New Workbooks for unique values

Ron,
Thanks for the response. I am still relatively new to writing macros,
so hopefully this next problem isn't too basic, but when I run the code
in excel for the workbook in question I receive an error when the code
tries to set WS1

Set ws1 = ThisWorkbook.Sheets("NewCash") '<<< Change

I thought that this referred to the name of the sheet which I wish to
manipulate, but it says that the subscript is out of range. Any advice
on why this would fail. The sheet will always be named "NewCash" as I
add this worksheet earlier in the macro with this name with the
following
ActiveWorkbook.Worksheets.Add.Name = "NewCash"

And for this command -
WBNew.SaveAs FileFolder & Format(Now, "yyyy-mmm-dd hh-mm-ss") & " Value
= " & cell.Value
WBNew.SaveAs "H:\Operations\Daily Activities\DayMan New Cash", & "
Value = " & cell.Value
How can I specify a place - always the same place for the new workbooks
to go, and I would like the filename to be the cell value from the
column indicated(4 in this case) but not the header with "NewCash"
following it.
I tried
ActiveWorkbook.SaveAs ActiveSheet.Name & "NewCash " & ".xls"
but that only worked when the name for the new sheet in the new
workbook created from the master workbook copied the unique value for
which the workbook was created e.g. if KT were one of the unique values
I would like the workbook to save as KTNewCash.
Thanks again for your help.