Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Generate a filename from cell range? Anyone.

I need to save workorders using customer data. I'd like to run a macro that
does this automatically using data from range A2:D2 or E2 (which is a data
merge of the previous named cells,A2,B2,C2,D2.
I've been on this task for 3 days and I am just not getting it. Any help
would be helpfull. Thanks Bill T.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,276
Default Generate a filename from cell range? Anyone.

Hi,
in a macro
sub save_it()
dim fname
with activeworkbook
fname = .worksheets("sheet1").range("E2").value & ".xls"
..saveas fname
end with
end sub

"fail2excel" wrote:

I need to save workorders using customer data. I'd like to run a macro that
does this automatically using data from range A2:D2 or E2 (which is a data
merge of the previous named cells,A2,B2,C2,D2.
I've been on this task for 3 days and I am just not getting it. Any help
would be helpfull. Thanks Bill T.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Generate a filename from cell range? Anyone.

You don't mention anything about the path where you want to save the file.
Here is some code to save the new file in the same spot as the existing
file...

sub test
with thisworkbook
.saveas thisworkbook.path & "\" & Sheets("MySheet").Range("E2").value
end with
end sub

Where it says
Sheets("MySheet").
Change MySheet
to the appropriate tab name.
--
HTH...

Jim Thomlinson


"fail2excel" wrote:

I need to save workorders using customer data. I'd like to run a macro that
does this automatically using data from range A2:D2 or E2 (which is a data
merge of the previous named cells,A2,B2,C2,D2.
I've been on this task for 3 days and I am just not getting it. Any help
would be helpfull. Thanks Bill T.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Generate a filename from cell range? Anyone.

On Jul 20, 9:52*am, fail2excel
wrote:
I need to save workorders using customer data. *I'd like to run a macro that
does this automatically using data from range A2:D2 or E2 (which is a data
merge of the previous named cells,A2,B2,C2,D2.
I've been on this task for 3 days and I am just not getting it. *Any help
would be helpfull. Thanks Bill T.



Sub workorder()
'Saves filename as value of (CELL INFORMATION) plus the current date

Dim newFile As String, fName As String
' Don't use "/" in date, invalid syntax
fName = Range("E2").Value
'Change the date format to whatever you'd like, but make sure
it's in quotes
newFile = fName & " " & Format$(Date, "mm-dd-yyyy")
' Change the directory and file path to yours and saves file as
shipment number, date, and time
ActiveWorkbook.SaveAs Filename:="C:\JohnSims\MyFiles\WorkOrders\ "
& Range("E2").Value & " - " & Format(Now, "yyyy-mm-dd_hhmmss")

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I use a worsheet name (filename), and a range name as values? RobertoB Excel Discussion (Misc queries) 2 October 28th 08 09:28 PM
Cell("filename") doesn't update to new filename when do save as. Louis Excel Worksheet Functions 2 March 22nd 07 07:27 PM
Using Range().Formula with a Filename & Path BJTex Excel Discussion (Misc queries) 1 November 11th 06 02:49 AM
How do I generate a list from a range of values robo7084 Excel Worksheet Functions 2 July 6th 06 01:48 AM
Using TODAY() to generate a filename from where values are VLOOKUPed dolik Links and Linking in Excel 2 June 14th 05 11:53 PM


All times are GMT +1. The time now is 10:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"