Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Right()" and "Left()" in VBA for XL2002

Status
Not open for further replies.

slystarnes

Technical User
Oct 2, 2003
4
US
I am trying to use the "Right(string, #)" and "Left(string, #)" in Excel 2002, and when I run the macro, I get a "Compile Error: Can't find project or library." Am I missing an Add-In, or something? Or is this an invalid procedure in XL2002?
 
Hi,

NOPE! standard VB.

Post your entire code and exactly where the error is occurring. (ie when you get the error message, hit the Debug button and tell me where you are?)

Skip,
Skip@TheOfficeExperts.com
 
For sex = 0 To 1
For Class = 0 To 4
For band = 0 To 4
currRow = CInt(Right(ActiveCell.Address, Len(ActiveCell.Address) - 3))
ActiveCell.Value = "=IF(B$17+$A" & currRow & ">100,0,VLOOKUP(""" & strSex(sex) & strClass(Class) & strBand(band) & """&B$17,Mortality,6+$A" & currRow & ",FALSE)*VLOOKUP(""" & strSex(sex) & strClass(Class) & strBand(band) & """&B$17,RSUFactors,$A" & currRow & "+2,FALSE))/1000"
Selection.AutoFill Destination:=ActiveCell.Range("A1:H1"), Type:= _
xlFillDefault
ActiveCell.Range("A1:H1").Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:H86"), Type:= _
xlFillDefault
ActiveCell.Range("A1:H86").Select
ActiveCell.Offset(88, 0).Range("A1").Select
Next band
Next Class
Next sex
Application.Calculation = xlCalculationAutomatic


The error Occurs as soon as I tell the Macro to Run.
 
The variables are all defined above the part of the macro that I posted. When the error occurs, and I debug, the "Right" is the part that is highlighted.

currRow = CInt(Right(ActiveCell.Address, Len(ActiveCell.Address) - 3))

This is the part that doesn't seem to be working.
 
I answered the post from 2 times ago already. Do you see the thread name? "Right()" only appears in one place in the section of code that I sent as a reply. Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top