Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Assigning a value to an array cell

Hi,

I am trying to assign a value to a specific cell in an array (inside a
For loop). But for some reason this assignment breaks the loop. Here's
the declaration and the For loop:

Dim yrow() As Integer
Dim i As Integer, k As Integer
k = 0
For i = 1 To lrow

If IsNumeric(Cells(i, 2).Value) = False Then
k = k + 1
MsgBox "*"
yrow(k) = i
MsgBox "**"
End If
i = i + 1
Next i
The First message box pops up but not the second. And the For loop is
not continued further (I guess it is broken)Please help.

Srikanth

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Assigning a value to an array cell

Dim yrow() As Integer
Dim i As Integer, k As Integer
k = 0
' lrow gets assigned a value where?
Redim yrow(1 to lrow)
For i = 1 To lrow

If IsNumeric(Cells(i, 2).Value) = False Then
k = k + 1
MsgBox "*"
yrow(k) = i
MsgBox "**"
End If
i = i + 1
Next i

Redim Preserve yrow(1 to k)

--
Regards,
Tom Ogilvy

"Srikanth Ganesan" wrote in message
...
Hi,

I am trying to assign a value to a specific cell in an array (inside a
For loop). But for some reason this assignment breaks the loop. Here's
the declaration and the For loop:

Dim yrow() As Integer
Dim i As Integer, k As Integer
k = 0
For i = 1 To lrow

If IsNumeric(Cells(i, 2).Value) = False Then
k = k + 1
MsgBox "*"
yrow(k) = i
MsgBox "**"
End If
i = i + 1
Next i
The First message box pops up but not the second. And the For loop is
not continued further (I guess it is broken)Please help.

Srikanth

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



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
Assigning range to array not working Marston Excel Programming 2 August 12th 04 11:38 PM
Assigning 10x1 array to 2nd collumn of 10x3 array Alan Beban[_2_] Excel Programming 0 July 30th 04 01:38 AM
Assigning 10x1 array to 2nd collumn of 10x3 array Myrna Larson Excel Programming 0 July 29th 04 11:57 PM
Assigning array to range inside Excel Object Jon Peltier Excel Programming 0 April 1st 04 11:14 PM
Assigning Array Values MWE[_16_] Excel Programming 6 January 26th 04 04:35 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"