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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XL2003 - Macros fail at Range using square brackets

Status
Not open for further replies.

MeGustaXL

Technical User
Aug 6, 2003
1,055
GB
Hi All,

I've recently started re-using a VBA application I developed long ago, when I was using Office 97. It has a lot of "speeding up" features, in particular, ranges are referred to within square brackets, e.g.
Code:
If [C14]<54 then [Total]=[C20]
.

Now it stops with a Compile error "Can't find project or library" EVERY TIME it encounters one of these bracket-delimited range statements!
Here's an example. This stops with the first line highlighted yellow, and the first occurrence of [G12] highlighted blue:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo 21
If Target = [G12] Then
[G15].Value = 1 / [G12] * 1000000
End If
If Target = [G15] Then
[G12].Value = 1 / ([G15] / 1000000)
End If
21
End Sub

Does this mean I'll have to go through ALL the code and change these references?

I really hope not, because there are 12 sheets and 16 Modules, each with an average of 130 lines, most of which use this method.

I'm using Office 2003, with VBA Version 6.5

Chris

Someday I'll know what I'm donig...damn!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top