Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following is step one in what is turning out to be a complex
(at least for me) procedure. I hope someone has the patience to walk me thru these basics. I feel like I'm missing a few "keys", in understanding the terminolgy, etc., as it relates to defining variables. Option Explicit Sub SeqNum() ' Quote Number Macro ' 9-27-05: To assign quote number to Contract forms ' Keyboard Shortcut: Ctrl+Shift+Q ' Salesman has saved the contract with a new name (unknown name) ' The following (from McGimpsey & Associates) is to insert new File name ' of new Contract to Cell G42, of the contract ' (The file name will be different each time this procedure is used). Dim RngToCopy As Range Dim DestCell As Range 'THE FOLLOWING is what is causing the grief, so far. ' The 1st G42, "Compile Error, Variable not Defined Total = Mid(Left(CELL("filename", G42), Find("]", _ CELL("filename", G42)) - 1), Find("[", CELL("filename", G42)) + 1, 255) ' File QCNUM.xls to be opened ' File name in G42 to be copied to F8 in QCNUM.xls ' Will try to use the file name to direct the further required copying and pasting ' instructions into the correct file. (to be added later) ' To Copy FROM (Newly Named Quote, Cell G42) With Workbooks(Cell G42).Worksheets("Contract") Set RngToCopy = .Range("G42") ' To Paste INTO (QCNUM.xls must be opened first) With Workbooks(c:\Excel Add_Ins\QCNUM.xls).Worksheets("Sheet1").Open Set DestCell = .Range("F8") End With 'Save and Close QCNUM.xls With Workbooks("QCNUM.xls") .Save .Close SaveChanges:=True End With End Sub 'There is a lot more to come, but I don't feel the rest will be near as tough as this is (to me) Thanks in advance. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to use variables to define range | Excel Programming | |||
How do you define variables in excel? | Excel Discussion (Misc queries) | |||
Help needed with basic MACRO | Excel Programming | |||
Help needed with basic MACRO | Excel Programming | |||
Could we define series variables in one statement? | Excel Programming |