Subscript out of range error

G

Guest

I'm getting error #9 subscript of of range error that I cannot figure out.

the error occors on the line with

cPhones = rPhones.Find(.Customer, LookIn:=xlValue)

Below is part of the code that give me the issue.



Sub sSetupPhones(recBP As defBP, pCustomer As String)

Dim nIdx As Integer

Dim cPhones As Range
Dim cFaxes As Range

Dim rPhones As Range
Dim rFaxes As Range

Set rPhones = Range("tPhones")
Set rFaxes = Range("tFaxes")

With recBP

cPhones = rPhones.Find(.Customer, LookIn:=xlValue)
If Not cPhones Is Nothing Then
....


recBP is a custom type which does have the following declaration

type defBP
Customer As String ' A Customer Number
....

CommID(6) As String ' CT Communication Identification
CommType(6) As String ' CU Communication Type
CommExt(6) As String ' CV Communication Extention
CommRemark(6) As String
Message As String ' DI Message
end type

The subroutine sSetupPhone is called from another sub program that passes
the type structure and the .customer field has a value of "10026241"

Thanks in advance

Guy Normandeau
 
G

Guest

cPhones = rPhones.Find(.Customer, LookIn:=xlValue)

should be

set cPhones = rPhones.Find(.Customer, LookIn:=xlValue)
 
G

Guest

Now I feel a little stupid! Not only did I not have 'set', xlValue does not
esist! It should have read xlValues.

Thanks for you help.

Guy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top