Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
To remove a module, go to the project explorer in the VBE and right click on
a module in the project tree. Choose Remove and don't export the code if you don't need it (I assume you would only delete modules you didn't need and I couldn't imagine that you need 80 modules.). Dim Target as Range lines, each involving only two lines of code: Target.FormulaR1C1 = ... ; and Target.Value = Target.Value These aren't Dim lines (note that dim does not appear in either.) these are assignment statements. Dim is to define a variable in terms of scope and type. sub Macro1() Dim myvar as Long '<== Dim statement myvar = 12 '<== Assignment statement msgbox Myvar '<== command End sub -- Regards, Tom Ogilvy "Chuckles123" wrote in message ... I had (fortunately, not have) a sick macro (at least I think HAD). When opening, and when saving, the workbook containing the macro, I received "Compile error: Invalid outside procedure" -- on the same screen, a range name or a cell location in the coding would be highlighted. Also, when doing Alt+{F8}, the name of the macro with the problem did NOT appear; furthermore, the other 12 macros listed had the file name plus the Module number preceding each macro name. My solution was to copy the macro contents to the Clipboard, delete all of the text in the problem macro, and then save the workbook. I then re-opened the workbook (this time there was no problem). I then created a new macro, re-named it, pasted the text from the Clipboard, and then saved the workbook. I have two theories as to what happened: As I said above, 13 macros; all but one (not the problem macro) of them are connected, maybe a 1,000 lines of code. Somehow, I have about 80 Modules; I have made numerous macro edits -- I did nothing else that I am aware of to create these Modules. Is this a problem? Secondly, I have 3 MsgBoxes in these macros (2 of them are in the problem macro), each containing Yes and No buttons. Each has the following line of code: Dim Msg, Style, Title, Response. I think when I had created only 2 of these boxes, the compiler did not have a problem. But, when I created the third, the compiler definitely had a problem -- I deleted one or two of the Dim lines and everything appeared to work OK. I also had two Dim Target as Range lines, each involving only two lines of code: Target.FormulaR1C1 = ... ; and Target.Value = Target.Value (I think both of these Dim lines are in the same macro, but not the problem one); the compiler forced me to delete one of these Dim lines. Are my Dim lines a problem? I would like to create one more MsgBox. Any help would be appreciated. Chuckles123 -- Chuckles123 ------------------------------------------------------------------------ Chuckles123's Profile: http://www.excelforum.com/member.php...o&userid=14948 View this thread: http://www.excelforum.com/showthread...hreadid=266313 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
convert lotus 123w macros to excel macros | Excel Programming | |||
convert lotus 123w macros to excel macros | Excel Programming | |||
Open workbook-macros enabled, opening another with macros | Excel Programming | |||
Macro Size Limit / open macros with macros? | Excel Programming | |||
Macros not appearing in the Tools Macro Macros list | Excel Programming |