![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 473
|
Hi ..
I have a workbook the first worksheet contains several line items (about 500 lines). In ColA a quantity is entered. I then have a macro which moves all the items with a quantity in to the top of the list. I have cells in the first sheet which include a customer name and address. I would like to move certain selected cells such as Name / Address / Qtys / Prices / Description etc to Worksheet 2 and then save the file, this is the hard bit, or maybe not. I would like to auto generate a number for use in the filename every time the macro is run but also need to include the date and the customers name e.g. 001 I would then like another macro within worksheet 2 to export the information into a pre-prepared word document. Thanks for the help. Ted |
|
|
|
|
|
#2 | |
|
Guest
Posts: n/a
|
Quote:
There are several ways of doing this, the way I have found best is to use a hidden workbook which holds a serial number or number. This number is held in cell A1 In my case the serial number file is fired up automatically when excel is fired up (like personal.xls). Sub SerialNumber() 'Increment SerialNumber Range("[SerialNumber.xls]Sheet1!A1").Formula = Range("[SerialNumber.xls]Sheet1!A1").Value + 1 Workbooks("SerialNumber.xls").Save SerialNumber = Range("[SerialNumber.xls]Sheet1!A1").Value 'Replace CustomerName with code to reference your CustomerName Filename = SerialNumber & CustomerName & Format(Date, "dd-mm-yyyy") ' Then use Filename in your Save As code for the workbook. End Sub |
|
|
|
|
#3 | ||
|
Board Regular
Join Date: Feb 2002
Location: Chippenham, UK
Posts: 136
|
Quote:
__________________
Regards, Gary Hewitt-Long |
||
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,510
|
__________________
~Anne Troy |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|