Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
mid function causes a compile error
Hi all, I have a problem that I cannot solve.
I have a routine that prints various registers for groups of pupils. the routine checks each of the controls on a userform if the control is a checkbox and its value is true then the caption of the checkbox is analysed. This is where the problem occurs. I am using the following code, whenever I run the sub, I get an error message along the lines of "compile error: cannot find project or library" Here's the code - For Each thing In RotationRegisterForm.Controls If Mid(thing.Caption, 1, 2) = "11" Then ActiveSheet.Range("rotStart11Dates").Range("a4").S elect the rest of my code follows I'm not sure what to do about it. Also whenever I am naming a range of cells in excel I get an identical error message to the one above. Is the problem caused by one of the names I have chosen for a range? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
mid function causes a compile error
After the error, go into Tools=References in the VBE. Make sure this
workbook is the only one open or at least that it is the activeproject in the VBE (selected in the project explorer window). You should see one or more references marked as MISSING. You need to use the browse button to find the library or uncheck the reference if you can. The reference probably won't have anything to do with the MID function, but that is just where it manifests itself. If you have trouble fixing it, a bandaid approach is to qualify MID with VBA For Each thing In RotationRegisterForm.Controls If VBA.Mid(thing.Caption, 1, 2) = "11" Then ActiveSheet.Range("rotStart11Dates").Range("a4").S elect -- Regards, Tom Ogilvy "Brotherwarren" wrote: Hi all, I have a problem that I cannot solve. I have a routine that prints various registers for groups of pupils. the routine checks each of the controls on a userform if the control is a checkbox and its value is true then the caption of the checkbox is analysed. This is where the problem occurs. I am using the following code, whenever I run the sub, I get an error message along the lines of "compile error: cannot find project or library" Here's the code - For Each thing In RotationRegisterForm.Controls If Mid(thing.Caption, 1, 2) = "11" Then ActiveSheet.Range("rotStart11Dates").Range("a4").S elect the rest of my code follows I'm not sure what to do about it. Also whenever I am naming a range of cells in excel I get an identical error message to the one above. Is the problem caused by one of the names I have chosen for a range? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
mid function causes a compile error | Excel Programming | |||
Trying to use INDEX function in VBA Code, compile error | Excel Programming | |||
Help With - Compile Error: Sub or Function Not Defined | Excel Programming | |||
Chrw function giving compile error. | Excel Programming | |||
compile error using Left() function | Excel Programming |