#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Run-time error '91'

I get a run-time error '91' with the line of code - StartUpSheet(RowCounter,
1) = cellVal - in the code below. I've used the Excel help - but can't
figure out what object variable I need to set. What don't I understand? I've
dimensioned the array and other variables in a global variable area at the
head of the application code.

Bob Allen

RowCounter = 0
CellCounter = 0
nextChkBox = 1
ActiveRow = 0

Worksheets("Start_Up_Pricing").Activate

For Each cell In Range("A3:B86")
CellCounter = CellCounter + 1
cellVal = cell.Value
MsgBox cellVal
If MsgBox("quit now", vbYesNo) = vbYes Then
GoTo bob1
End If
a = CellCounter Mod 2
If CellCounter = 1 Then a = 0

If a = 0 Then ColumnA = yes
If ColumnA = yes Then
RowCounter = RowCounter + 1
'ActiveRow = ActiveRow + 1
StartUpSheet(RowCounter, 1) = cellVal
StartUpSheet(RowCounter, 2) = cell.Offset(0, 1).Value
StartUpSheet(RowCounter, 3) = cell.Offset(0, 3).Value
StartUpSheet(RowCounter, 4) = cell.Offset(0, 4).Value
StartUpSheet(RowCounter, 5) = cell.Offset(0, 5).Value
End If
array_5 = StartUpSheet(RowCounter, 5)
MsgBox array_5
Next cell
GoTo bob1
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Run-time error '91'

Addendum to code cited below - 2 additional dim statements -
Dim a As Integer
Dim cell As Range

RowCounter = 0
CellCounter = 0
nextChkBox = 1
ActiveRow = 0

Worksheets("Start_Up_Pricing").Activate.......

Bob Allen

"Bob Allen" wrote:

I get a run-time error '91' with the line of code - StartUpSheet(RowCounter,
1) = cellVal - in the code below. I've used the Excel help - but can't
figure out what object variable I need to set. What don't I understand? I've
dimensioned the array and other variables in a global variable area at the
head of the application code.

Bob Allen

RowCounter = 0
CellCounter = 0
nextChkBox = 1
ActiveRow = 0

Worksheets("Start_Up_Pricing").Activate

For Each cell In Range("A3:B86")
CellCounter = CellCounter + 1
cellVal = cell.Value
MsgBox cellVal
If MsgBox("quit now", vbYesNo) = vbYes Then
GoTo bob1
End If
a = CellCounter Mod 2
If CellCounter = 1 Then a = 0

If a = 0 Then ColumnA = yes
If ColumnA = yes Then
RowCounter = RowCounter + 1
'ActiveRow = ActiveRow + 1
StartUpSheet(RowCounter, 1) = cellVal
StartUpSheet(RowCounter, 2) = cell.Offset(0, 1).Value
StartUpSheet(RowCounter, 3) = cell.Offset(0, 3).Value
StartUpSheet(RowCounter, 4) = cell.Offset(0, 4).Value
StartUpSheet(RowCounter, 5) = cell.Offset(0, 5).Value
End If
array_5 = StartUpSheet(RowCounter, 5)
MsgBox array_5
Next cell
GoTo bob1

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Run-time error '91'

Why dont you post the array declarations

?StartUpSheet
?array_5

If this post helps click Yes
---------------
Jacob Skaria


"Bob Allen" wrote:

Addendum to code cited below - 2 additional dim statements -
Dim a As Integer
Dim cell As Range

RowCounter = 0
CellCounter = 0
nextChkBox = 1
ActiveRow = 0

Worksheets("Start_Up_Pricing").Activate.......

Bob Allen

"Bob Allen" wrote:

I get a run-time error '91' with the line of code - StartUpSheet(RowCounter,
1) = cellVal - in the code below. I've used the Excel help - but can't
figure out what object variable I need to set. What don't I understand? I've
dimensioned the array and other variables in a global variable area at the
head of the application code.

Bob Allen

RowCounter = 0
CellCounter = 0
nextChkBox = 1
ActiveRow = 0

Worksheets("Start_Up_Pricing").Activate

For Each cell In Range("A3:B86")
CellCounter = CellCounter + 1
cellVal = cell.Value
MsgBox cellVal
If MsgBox("quit now", vbYesNo) = vbYes Then
GoTo bob1
End If
a = CellCounter Mod 2
If CellCounter = 1 Then a = 0

If a = 0 Then ColumnA = yes
If ColumnA = yes Then
RowCounter = RowCounter + 1
'ActiveRow = ActiveRow + 1
StartUpSheet(RowCounter, 1) = cellVal
StartUpSheet(RowCounter, 2) = cell.Offset(0, 1).Value
StartUpSheet(RowCounter, 3) = cell.Offset(0, 3).Value
StartUpSheet(RowCounter, 4) = cell.Offset(0, 4).Value
StartUpSheet(RowCounter, 5) = cell.Offset(0, 5).Value
End If
array_5 = StartUpSheet(RowCounter, 5)
MsgBox array_5
Next cell
GoTo bob1

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Run-time error '91'

Hi Jacob,

Yes - you helped MUCH on this. I went back and looked at the DIM of the
StartUpSheet() array - and it was explicitly defined "as character" - when in
fact OFFSET (0,3), (0,4), and (0,5) as defined within the Worksheet as
Numeric. I removed the explicit "as character" from the array DIM - and the
91 error goes away.

I'm VERY new at BOTH VBA and Excel - and it shows! Thanks again!

PS array_5 was just a variable name - that errors out as a type mis-match in
the Msgbox - but I know where that problem resides.

Bob Allen

"Jacob Skaria" wrote:

Why dont you post the array declarations

?StartUpSheet
?array_5

If this post helps click Yes
---------------
Jacob Skaria


"Bob Allen" wrote:

Addendum to code cited below - 2 additional dim statements -
Dim a As Integer
Dim cell As Range

RowCounter = 0
CellCounter = 0
nextChkBox = 1
ActiveRow = 0

Worksheets("Start_Up_Pricing").Activate.......

Bob Allen

"Bob Allen" wrote:

I get a run-time error '91' with the line of code - StartUpSheet(RowCounter,
1) = cellVal - in the code below. I've used the Excel help - but can't
figure out what object variable I need to set. What don't I understand? I've
dimensioned the array and other variables in a global variable area at the
head of the application code.

Bob Allen

RowCounter = 0
CellCounter = 0
nextChkBox = 1
ActiveRow = 0

Worksheets("Start_Up_Pricing").Activate

For Each cell In Range("A3:B86")
CellCounter = CellCounter + 1
cellVal = cell.Value
MsgBox cellVal
If MsgBox("quit now", vbYesNo) = vbYes Then
GoTo bob1
End If
a = CellCounter Mod 2
If CellCounter = 1 Then a = 0

If a = 0 Then ColumnA = yes
If ColumnA = yes Then
RowCounter = RowCounter + 1
'ActiveRow = ActiveRow + 1
StartUpSheet(RowCounter, 1) = cellVal
StartUpSheet(RowCounter, 2) = cell.Offset(0, 1).Value
StartUpSheet(RowCounter, 3) = cell.Offset(0, 3).Value
StartUpSheet(RowCounter, 4) = cell.Offset(0, 4).Value
StartUpSheet(RowCounter, 5) = cell.Offset(0, 5).Value
End If
array_5 = StartUpSheet(RowCounter, 5)
MsgBox array_5
Next cell
GoTo bob1

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Run-time error '91'

Hi Jacob,

I have something NEW to ask. I can NO LONGER start a NEW thread on this
site - and MicroSoft Support tells me on the phone that they are no longer
supporting this site!

SO - do you know of an alternative?

Bob Allen

"Jacob Skaria" wrote:

Why dont you post the array declarations

?StartUpSheet
?array_5

If this post helps click Yes
---------------
Jacob Skaria


"Bob Allen" wrote:

Addendum to code cited below - 2 additional dim statements -
Dim a As Integer
Dim cell As Range

RowCounter = 0
CellCounter = 0
nextChkBox = 1
ActiveRow = 0

Worksheets("Start_Up_Pricing").Activate.......

Bob Allen

"Bob Allen" wrote:

I get a run-time error '91' with the line of code - StartUpSheet(RowCounter,
1) = cellVal - in the code below. I've used the Excel help - but can't
figure out what object variable I need to set. What don't I understand? I've
dimensioned the array and other variables in a global variable area at the
head of the application code.

Bob Allen

RowCounter = 0
CellCounter = 0
nextChkBox = 1
ActiveRow = 0

Worksheets("Start_Up_Pricing").Activate

For Each cell In Range("A3:B86")
CellCounter = CellCounter + 1
cellVal = cell.Value
MsgBox cellVal
If MsgBox("quit now", vbYesNo) = vbYes Then
GoTo bob1
End If
a = CellCounter Mod 2
If CellCounter = 1 Then a = 0

If a = 0 Then ColumnA = yes
If ColumnA = yes Then
RowCounter = RowCounter + 1
'ActiveRow = ActiveRow + 1
StartUpSheet(RowCounter, 1) = cellVal
StartUpSheet(RowCounter, 2) = cell.Offset(0, 1).Value
StartUpSheet(RowCounter, 3) = cell.Offset(0, 3).Value
StartUpSheet(RowCounter, 4) = cell.Offset(0, 4).Value
StartUpSheet(RowCounter, 5) = cell.Offset(0, 5).Value
End If
array_5 = StartUpSheet(RowCounter, 5)
MsgBox array_5
Next cell
GoTo bob1

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
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
Receiving run-time error only part of the time [email protected] Excel Discussion (Misc queries) 0 August 11th 07 12:01 AM
run-time error '91'-Close Button error ASCO IS Help Excel Discussion (Misc queries) 1 May 8th 06 04:25 PM
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM


All times are GMT +1. The time now is 07:32 AM.

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"