Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Error 13 with combobox

Hi everyone,

I had a error when I run my code.

Private Sub ComboBox3_Change()
Dim L As Long
Dim tabtemp as variant

With Worksheets("Sheet1")
L = .Range("a5000").End(xlUp).Row
tabtemp = .Range("A2:K" & L)
End With

For L = 1 To UBound(tabtemp, 1) ------------------------------ error 13 ?
If tabtemp(L, 1) = CLng(ComboBox3.Value) Then
ListBox1.AddItem tabtemp(L, 1)
ListBox2.AddItem tabtemp(L, 2)
ListBox3.AddItem tabtemp(L, 3)
ListBox4.AddItem tabtemp(L, 4)
ListBox5.AddItem tabtemp(L, 8)
ListBox6.AddItem tabtemp(L, 6)
ListBox7.AddItem tabtemp(L, 7)
ListBox8.AddItem tabtemp(L, 5)
End If
Next L

End Sub

Anyone can help ? Please :)

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Error 13 with combobox

tabtemp is not an array it is a range object (A Group of 1 or more cells) try
something more like this...

dim rngToSearch as range
dim rngCurrent as range

set rngToSearch = range(sheets("Sheet1").Range("A2"), _
sheets("Sheet1").Range("A65536").End(xlUP))

for each rngCurrent in rngToSearch
If rngCurrent.Value = CLng(ComboBox3.Value) Then
ListBox1.AddItem rngCurrent.Value
ListBox2.AddItem rngCurrent.Offset(0,1).Value
ListBox3.AddItem rngCurrent.Offset(0,2).Value
ListBox4.AddItem rngCurrent.Offset(0,3).Value
ListBox5.AddItem rngCurrent.Offset(0,7).Value
ListBox6.AddItem rngCurrent.Offset(0,5).Value
ListBox7.AddItem rngCurrent.Offset(0,6).Value
ListBox8.AddItem rngCurrent.Offset(0,4).Value
End If

Next rngCurrent

--
HTH...

Jim Thomlinson


"Linebaker" wrote:

Hi everyone,

I had a error when I run my code.

Private Sub ComboBox3_Change()
Dim L As Long
Dim tabtemp as variant

With Worksheets("Sheet1")
L = .Range("a5000").End(xlUp).Row
tabtemp = .Range("A2:K" & L)
End With

For L = 1 To UBound(tabtemp, 1) ------------------------------ error 13 ?
If tabtemp(L, 1) = CLng(ComboBox3.Value) Then
ListBox1.AddItem tabtemp(L, 1)
ListBox2.AddItem tabtemp(L, 2)
ListBox3.AddItem tabtemp(L, 3)
ListBox4.AddItem tabtemp(L, 4)
ListBox5.AddItem tabtemp(L, 8)
ListBox6.AddItem tabtemp(L, 6)
ListBox7.AddItem tabtemp(L, 7)
ListBox8.AddItem tabtemp(L, 5)
End If
Next L

End Sub

Anyone can help ? Please :)

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Error 13 with combobox

Corrected.

"Linebaker" a écrit dans le message de news:
...
Hi everyone,

I had a error when I run my code.

Private Sub ComboBox3_Change()
Dim L As Long
Dim tabtemp as variant

With Worksheets("Sheet1")
L = .Range("a5000").End(xlUp).Row
tabtemp = .Range("A2:K" & L)
End With

For L = 1 To UBound(tabtemp, 1) ------------------------------ error 13 ?
If tabtemp(L, 1) = CLng(ComboBox3.Value) Then
ListBox1.AddItem tabtemp(L, 1)
ListBox2.AddItem tabtemp(L, 2)
ListBox3.AddItem tabtemp(L, 3)
ListBox4.AddItem tabtemp(L, 4)
ListBox5.AddItem tabtemp(L, 8)
ListBox6.AddItem tabtemp(L, 6)
ListBox7.AddItem tabtemp(L, 7)
ListBox8.AddItem tabtemp(L, 5)
End If
Next L

End Sub

Anyone can help ? Please :)

Thanks



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
SetFocus from ComboBox to Calendar gives Run-time error Paulbram Excel Programming 1 April 27th 05 07:50 AM
Combobox creates error Stephen Excel Worksheet Functions 0 January 23rd 05 10:55 AM
ComboBox processing error Jim Berglund Excel Programming 4 November 16th 04 02:08 AM
error (ComboBox-?) Alex Excel Programming 2 June 18th 04 02:52 AM
Combobox run time error Oreg[_18_] Excel Programming 1 June 7th 04 04:46 AM


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