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: 536
Default Dim IndxNum As Long & Dim c As Variant

I believe the problem is with the InputBox IndxNum and the Variant c.

The IndxNum in this case is a number and the For Each c requires a Variant.
Seems they not be compatible.

Also, have not got far enough to test it, but will the next MyStringVariable be listed below the previous or do I need the & vbCr at the end of MyStringVariable?

I have Multi Line = TRUE in properties.

Thanks,
Howard

Option Explicit

Sub TheT_Box()
Dim MyStringVariable As String
Dim IndxNum As Long
Dim IndexCol As Range
Dim c As Variant

Set IndexCol = Range("A2:A7")

IndxNum = Application.InputBox(Prompt:="Enter an Number.", _
Title:="Enter Index Number", Type:=1) ' 1 = number
If IndxNum = "" Or IndxNum = "False" Then Exit Sub

For Each c In Range("IndexCol") 'Range("A2:A7")
If c.Value = IndxNum Then
MyStringVariable = c.Offset(0, 4).Value & ", " & c.Offset(0, 1).Value _
& c.Offset(0, 2).Value & ", " & c.Offset(0, 14).Value _
& ", " & c.Offset(0, 15).Value & ", " & c.Offset(0, 18).Value '& vbCr
TextBox1.Text = MyStringVariable
End If
Next ' c

End Sub
 
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
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo Max Loger Excel Discussion (Misc queries) 0 June 14th 11 04:30 PM
Long Long Long Nested If Function sed Excel Discussion (Misc queries) 4 December 9th 09 06:44 PM
Using created variant value to reference to a variant within my code TD[_3_] Excel Programming 1 April 22nd 09 11:53 AM
Clearing cells takes long, long time unclemuffin Excel Discussion (Misc queries) 9 August 17th 07 02:22 AM
variant to long? James Cornthwaite Excel Programming 1 June 11th 06 03:54 PM


All times are GMT +1. The time now is 02:29 AM.

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"