Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Subscript out of range error

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Subscript out of range error

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

should be

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

--
Regards,
Tom Ogilvy


"Guy Normandeau" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Subscript out of range error

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

"Tom Ogilvy" wrote:

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

should be

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

--
Regards,
Tom Ogilvy


"Guy Normandeau" wrote:

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

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
Runtime Error - Subscript out of range despite On Error statement DoctorG Excel Programming 3 July 28th 06 03:56 PM
Subscript out of range error - save copy error bg18461[_16_] Excel Programming 2 June 13th 06 04:53 PM
Subscript out of range error - save copy error bg18461[_15_] Excel Programming 1 June 13th 06 04:36 PM
Subscript out of range error moglione1 Excel Discussion (Misc queries) 2 August 30th 05 01:21 PM
Type Mismatch error & subscript out of range error Jeff Wright[_2_] Excel Programming 3 May 14th 05 07:14 PM


All times are GMT +1. The time now is 11:04 PM.

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"