ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   compile error using Left() function (https://www.excelbanter.com/excel-programming/286571-compile-error-using-left-function.html)

Bryce[_3_]

compile error using Left() function
 
Hi there.

Im trying to use the Left() function to extract the first
5 characters from strings that are in cells on 2 different
worksheets. I understand how to extract the strings, and
i understand how Left() works. But for the life of me i
cant find out why im getting a compiler error when i try
to use Left().
When i run my function i get the error "Compile error:
Can't find project or library". and it highlights the Left
function call. can anyone tell my whey this is happening?
iv search the forums, i search the support site, even
checked programming refrence books on VBA for Excel, but
none talk about a error like this.

Here is what my code looks like if you need to see it.
....
szTemp1 = Worksheets(1).Cells(nx, 22)
szTemp2 = Worksheets(2).Cells(nRange2,
nRange3)
szTemp1 = Left(szTemp1, 5)
szTemp2 = Left(szTemp2, 5)
....

Bill Li[_2_]

compile error using Left() function
 
Hi,

It is possible from missing library. Goto VB Editor, click
Tools in menu, check Referencs and it will list the
missing library in your file. Unselect the missing library
and re-run your code.

Best Regards

Bill


-----Original Message-----
Hi there.

Im trying to use the Left() function to extract the first
5 characters from strings that are in cells on 2

different
worksheets. I understand how to extract the strings, and
i understand how Left() works. But for the life of me i
cant find out why im getting a compiler error when i try
to use Left().
When i run my function i get the error "Compile error:
Can't find project or library". and it highlights the

Left
function call. can anyone tell my whey this is

happening?
iv search the forums, i search the support site, even
checked programming refrence books on VBA for Excel, but
none talk about a error like this.

Here is what my code looks like if you need to see it.
....
szTemp1 = Worksheets(1).Cells(nx, 22)
szTemp2 = Worksheets(2).Cells(nRange2,
nRange3)
szTemp1 = Left(szTemp1, 5)
szTemp2 = Left(szTemp2, 5)
....
.


bryce

compile error using Left() function
 
Cant find the missing refrence that i would need. Left()
is also listed in the Object Browser (so it should
technically be there, right?)

But anyways...found a work around for it. Since i only
want the first 5 character for it i set my szTemps's to *
5. Then copied the strings into there. Being that the
strings are set to a specific length it truncates the rest
of it. Im just waiting for me to need the right side of a
string then will have funn figuring that one out.

thanks for the response
-----Original Message-----
Hi,

It is possible from missing library. Goto VB Editor,

click
Tools in menu, check Referencs and it will list the
missing library in your file. Unselect the missing

library
and re-run your code.

Best Regards

Bill


-----Original Message-----
Hi there.

Im trying to use the Left() function to extract the

first
5 characters from strings that are in cells on 2

different
worksheets. I understand how to extract the strings,

and
i understand how Left() works. But for the life of me i
cant find out why im getting a compiler error when i try
to use Left().
When i run my function i get the error "Compile error:
Can't find project or library". and it highlights the

Left
function call. can anyone tell my whey this is

happening?
iv search the forums, i search the support site, even
checked programming refrence books on VBA for Excel, but
none talk about a error like this.

Here is what my code looks like if you need to see it.
....
szTemp1 = Worksheets(1).Cells(nx, 22)
szTemp2 = Worksheets(2).Cells(nRange2,
nRange3)
szTemp1 = Left(szTemp1, 5)
szTemp2 = Left(szTemp2, 5)
....
.

.


Patrick Molloy[_12_]

compile error using Left() function
 
make sure that you have properly DIM'd the two variables:
DIM szTemp1 As String
DIM szTemp2 As String

Now sometimes this error is misleading - under
Tools/References check to see if there are any "missing"
references...sometimes code is compiled on one machine
then run on another which may not have a relevent dll or
ocx installed. This often causes an error to highlight a
command which is in fact nothing to do with the cause of
the error.

Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
Hi there.

Im trying to use the Left() function to extract the

first
5 characters from strings that are in cells on 2

different
worksheets. I understand how to extract the strings,

and
i understand how Left() works. But for the life of me i
cant find out why im getting a compiler error when i try
to use Left().
When i run my function i get the error "Compile error:
Can't find project or library". and it highlights the

Left
function call. can anyone tell my whey this is

happening?
iv search the forums, i search the support site, even
checked programming refrence books on VBA for Excel, but
none talk about a error like this.

Here is what my code looks like if you need to see it.
....
szTemp1 = Worksheets(1).Cells(nx, 22)
szTemp2 = Worksheets(2).Cells(nRange2,
nRange3)
szTemp1 = Left(szTemp1, 5)
szTemp2 = Left(szTemp2, 5)
....
.


Tom Ogilvy

compile error using Left() function
 
Run the code till you get the error.

Make sure the workbook with the problem is the active **project** (not just
the active workbook).

Then go to tools references in the VBE.

You should see a reference shown as MISSING.

If you don't fix this, it will probably occur in some other line of code.

--
Regards,
Tom Ogilvy

"bryce" wrote in message
...
Cant find the missing refrence that i would need. Left()
is also listed in the Object Browser (so it should
technically be there, right?)

But anyways...found a work around for it. Since i only
want the first 5 character for it i set my szTemps's to *
5. Then copied the strings into there. Being that the
strings are set to a specific length it truncates the rest
of it. Im just waiting for me to need the right side of a
string then will have funn figuring that one out.

thanks for the response
-----Original Message-----
Hi,

It is possible from missing library. Goto VB Editor,

click
Tools in menu, check Referencs and it will list the
missing library in your file. Unselect the missing

library
and re-run your code.

Best Regards

Bill


-----Original Message-----
Hi there.

Im trying to use the Left() function to extract the

first
5 characters from strings that are in cells on 2

different
worksheets. I understand how to extract the strings,

and
i understand how Left() works. But for the life of me i
cant find out why im getting a compiler error when i try
to use Left().
When i run my function i get the error "Compile error:
Can't find project or library". and it highlights the

Left
function call. can anyone tell my whey this is

happening?
iv search the forums, i search the support site, even
checked programming refrence books on VBA for Excel, but
none talk about a error like this.

Here is what my code looks like if you need to see it.
....
szTemp1 = Worksheets(1).Cells(nx, 22)
szTemp2 = Worksheets(2).Cells(nRange2,
nRange3)
szTemp1 = Left(szTemp1, 5)
szTemp2 = Left(szTemp2, 5)
....
.

.




bryce

compile error using Left() function
 
Ya, there was a missing refrence, and un-checking it fixed
my problem. Im now worried about distribution of my sheet
to my users. Are they going to possibly get the same
error i did? Is there a way to prevent it from happening?

Thanks for the replies

-----Original Message-----
Run the code till you get the error.

Make sure the workbook with the problem is the active

**project** (not just
the active workbook).

Then go to tools references in the VBE.

You should see a reference shown as MISSING.

If you don't fix this, it will probably occur in some

other line of code.

--
Regards,
Tom Ogilvy

"bryce" wrote in message
...
Cant find the missing refrence that i would need. Left

()
is also listed in the Object Browser (so it should
technically be there, right?)

But anyways...found a work around for it. Since i only
want the first 5 character for it i set my szTemps's to

*
5. Then copied the strings into there. Being that the
strings are set to a specific length it truncates the

rest
of it. Im just waiting for me to need the right side

of a
string then will have funn figuring that one out.

thanks for the response
-----Original Message-----
Hi,

It is possible from missing library. Goto VB Editor,

click
Tools in menu, check Referencs and it will list the
missing library in your file. Unselect the missing

library
and re-run your code.

Best Regards

Bill


-----Original Message-----
Hi there.

Im trying to use the Left() function to extract the

first
5 characters from strings that are in cells on 2
different
worksheets. I understand how to extract the strings,

and
i understand how Left() works. But for the life of

me i
cant find out why im getting a compiler error when i

try
to use Left().
When i run my function i get the error "Compile error:
Can't find project or library". and it highlights the
Left
function call. can anyone tell my whey this is
happening?
iv search the forums, i search the support site, even
checked programming refrence books on VBA for Excel,

but
none talk about a error like this.

Here is what my code looks like if you need to see it.
....
szTemp1 = Worksheets(1).Cells(nx, 22)
szTemp2 = Worksheets(2).Cells(nRange2,
nRange3)
szTemp1 = Left(szTemp1, 5)
szTemp2 = Left(szTemp2, 5)
....
.

.



.


Tom Ogilvy

compile error using Left() function
 
Depending on what was referenced, there is certainly a high probability they
will if the machines are basically set up to be alike (such as in a
corporate setting).

Best is to fix your copy and redistribute (if you start getting reports of
problems).

--
Regards,
Tom Ogilvy

bryce wrote in message
...
Ya, there was a missing refrence, and un-checking it fixed
my problem. Im now worried about distribution of my sheet
to my users. Are they going to possibly get the same
error i did? Is there a way to prevent it from happening?

Thanks for the replies

-----Original Message-----
Run the code till you get the error.

Make sure the workbook with the problem is the active

**project** (not just
the active workbook).

Then go to tools references in the VBE.

You should see a reference shown as MISSING.

If you don't fix this, it will probably occur in some

other line of code.

--
Regards,
Tom Ogilvy

"bryce" wrote in message
...
Cant find the missing refrence that i would need. Left

()
is also listed in the Object Browser (so it should
technically be there, right?)

But anyways...found a work around for it. Since i only
want the first 5 character for it i set my szTemps's to

*
5. Then copied the strings into there. Being that the
strings are set to a specific length it truncates the

rest
of it. Im just waiting for me to need the right side

of a
string then will have funn figuring that one out.

thanks for the response
-----Original Message-----
Hi,

It is possible from missing library. Goto VB Editor,
click
Tools in menu, check Referencs and it will list the
missing library in your file. Unselect the missing
library
and re-run your code.

Best Regards

Bill


-----Original Message-----
Hi there.

Im trying to use the Left() function to extract the
first
5 characters from strings that are in cells on 2
different
worksheets. I understand how to extract the strings,
and
i understand how Left() works. But for the life of

me i
cant find out why im getting a compiler error when i

try
to use Left().
When i run my function i get the error "Compile error:
Can't find project or library". and it highlights the
Left
function call. can anyone tell my whey this is
happening?
iv search the forums, i search the support site, even
checked programming refrence books on VBA for Excel,

but
none talk about a error like this.

Here is what my code looks like if you need to see it.
....
szTemp1 = Worksheets(1).Cells(nx, 22)
szTemp2 = Worksheets(2).Cells(nRange2,
nRange3)
szTemp1 = Left(szTemp1, 5)
szTemp2 = Left(szTemp2, 5)
....
.

.



.





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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com