Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default mid function causes a compile error

This kind of error usually means that the VBA project
has a missing reference. From the VBA window select
Tools/References, and look for any items marked
"Missing". Clearing the checkboxes for these may
solve the problem: if you get new errors saying
"Unknown Type" or similar then you may need to
reinstall some DLLs.


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?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default mid function causes a compile error

See answer to later posting of this question.

--
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?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default mid function causes a compile error

many thanks to all those who replied. Tom Ogilvy's approach of
qualifying MID with vba. prefix helped! Cheers again.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to use INDEX function in VBA Code, compile error Finny[_3_] Excel Programming 14 July 26th 06 07:14 PM
Help With - Compile Error: Sub or Function Not Defined MWS Excel Programming 2 March 23rd 06 06:51 PM
Chrw function giving compile error. Hari Prasadh[_2_] Excel Programming 3 July 30th 05 12:21 PM
compile error: expected variable or function MMM Excel Discussion (Misc queries) 3 December 24th 04 03:11 PM
compile error using Left() function Bryce[_3_] Excel Programming 6 December 31st 03 10:01 PM


All times are GMT +1. The time now is 02:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"