Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Incremental Numbering: Compile Error - Variable not defined
Using Excel 2003
After weeks of researching and studying my books and various groups, I decided I had to start from scratch so I could understand what was happening. The following is my feeble attempt, so far. I'm getting stuck on the above problem. Even after going thru help files, etc., I can't determine exactly what I'm missing or over-looking. My various books, etc., advise that it is wise to start my code with "option Explicit". I think that is what is now stopping me in my tracks. If someone would be willing to work the code thru with me, it would be greatly appreciated. The Warning comes up on code line 7, =x1Values, Option Explicit ' The VB Code is in Module 11 of the "XXXXX" Menu Add-In. ' Upon completion of project, the SeqNum will be actived from this Add-In Menu. ' The Menu Sub-Item will read: Insert QUOTE #. ' Contract_Page1 is representative of Sheet #1 of each of the 12 workbooks ' that the Saleman works with. ' The Contract Number is to be put INTO Cell C5 of Sheet #1 of each/any ' of the Contracts - Whichever is being worked on at the time ' The "QCNUM.XLS", the Number Master Workbook, will be sent to each saleman ' to be installed in exactly the same path, on each computer, namely: ' C:\Excel Add_Ins\QCNUM.xls Sub SeqNum() 'Open Workbook C:\Excel Add_Ins\QCNUM.XLS Workbooks("C:\Excel Add_Ins\QCNUM.XLS").Worksheets("Sheet1").Activate 'Copy Cell H6 of QCNUM.xls Range("F6").Select Selection.Copy 'Paste into Open Contract Worksheet, Cell C5 '(The activeworkbook is the book that calls in the Add-In Workbook ' but under current conditions, I don't think this qualifies as being ' the active workbook) ActiveWorkbook.Activate Range("C5").Select 'PROBLEM LINE IS NEXT: Selection.PasteSpecial Paste:=x1Values, Operation:=x1None, _ SkipBlanks:=False, Transpose:=False ActiveWorkbook.Save GoTo Workbooks("C:\Excel Add_Ins\QCNUM.XLS").Worksheets("Sheet1") 'Copy Cell H4 of QCNUM.xls - Paste to Cell H3 of QCNUM.xls 'This copies the most recent used number into the "starting number" cell, 'which then makes cell H4 increment by 1 Range("F4").Select Selection.Copy Range("F3").Select Selection.PasteSpecial Paste:=x1Values, Operation:=x1None, _ SkipBlanks:=False, Transpose:=False 'Save QCNUM.xls FileSave ("C:\Excel Add_Ins\QCNUM.xls") ' Exit QCNUM.xls Close ("C:\Excel Add_Ins\QCNUM.xls") End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Microsoft Visual Basic: Compile error: Sum or Function not defined | Excel Worksheet Functions | |||
Incremental numbering | Excel Discussion (Misc queries) | |||
Variable not defined compile error | Excel Programming | |||
Compile error, variable not defined | Excel Programming | |||
compile error: expected variable or function | Excel Discussion (Misc queries) |