LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Dynamic arrays and type mismatches


Okay, you guys helped me immensely, your suggestions work great, but I'm
having one more problem (that I sort of created for myself ).
The problem is that I need to be able to output each of the values for
items that have less than 6 values. I'm only 50% successful. I
figured I needed a loop, so I declared an integer "l" and made this
loop:


Code:
--------------------
For l = 0 To j
Term2 = MsgBox("The values for this item a" & vbCr & vbCr & _
TNum(j) & ",", vbYesNoCancel + vbDefaultButton2, "Values")
Next l
--------------------


What it does, however, is display the values one at a time in the
message box. Then, for lack of better words, doubles the amount of
values shown. As in, if the values in the cells it looks at are 150
and 1783, I'll get 4 message boxes, the first saying "150,", I'll hit a
button, the next says "1783,", hit the button, and two more will pop up,
both containing "1783,".

I'm just trying to make the loop display each of the values with commas
in between each. I'll have to figure a way to make it omit the comma
on the last value.


Formula:
--------------------
Sub Search()
'

Dim TNum() As String, Term As String, Term2 As String, Iput As String, Iput2 As String
Dim j As Integer, k As Integer, l As Integer
Dim FoundCell As Range, FoundRow As Integer
j = 0

Iput = InputBox("Please enter item:") 'Input
Set FoundCell = Cells.Find(what:=Iput, LookIn:=xlFormulas, lookat:=xlWhole, _
searchorder:=xlByRows)
FoundRow = FoundCell.Row

For i = 2 To 7

If Worksheets(1).Cells(FoundRow, i).Value < "" Then
j = j + 1

ReDim Preserve TNum(1 To j)
TNum(j) = Worksheets(1).Cells(FoundRow, i).Value

End If
Next i

For l = 0 To j
Term2 = MsgBox("The values for this item a" & vbCr & vbCr & _
TNum(j) & ",", vbYesNoCancel + vbDefaultButton2, "Values")
Next l
--------------------


--
carg1
------------------------------------------------------------------------
carg1's Profile: http://www.excelforum.com/member.php...o&userid=15271
View this thread: http://www.excelforum.com/showthread...hreadid=383784

 
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
Dynamic Arrays chaz Excel Discussion (Misc queries) 1 May 23rd 06 12:43 AM
Dynamic Range and arrays PR Excel Discussion (Misc queries) 2 November 14th 05 03:51 AM
Dynamic arrays Driver New Users to Excel 3 November 7th 05 10:11 PM
Dynamic Arrays Chiba Excel Worksheet Functions 2 July 9th 05 03:58 AM
Dynamic Arrays Alan Beban[_2_] Excel Programming 12 December 9th 04 12:50 AM


All times are GMT +1. The time now is 08:52 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"