Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default start value in a combobox

Hi
i have this in a userform . combobox
Dim myrange3 As Range
On Error Resume Next

Set myrange3 =
Sheets(Range("kurt!$h$1").Value).Range(Range("kurt !$h$1").Value)
On Error GoTo 0
If myrange3 Is Nothing Then
MsgBox ("Ingen mapper i Gruppen")
Exit Sub
End If
For Each c In myrange3
kursist2.AddItem c.Text

Next
The same code is in another combobox and the get the same value but can't i
say that the second combobox shall start in the range after the first
combobox choice.

Maybe this is better
RAnge = 1-2-3-4-5-6-7-8-9-10 ..............
I make my choice in combobox1 and take 5 as value
Then i want my second combobox to start at 6 not again from 1
Can i do that?

Regards
alvin

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default start value in a combobox

I'm kind of confused at the ranges and worksheet names, but maybe something like
this will get you started:

Option Explicit
Dim myRng As Range
Private Sub ComboBox1_Change()
With Me.ComboBox1
If .ListIndex = myRng.Cells.Count - 1 Then
Me.ComboBox2.RowSource = ""
Me.ComboBox2.AddItem "Nothing to pick!"
Else
Me.ComboBox2.RowSource _
= myRng.Resize(myRng.Rows.Count - .ListIndex + 1, 1) _
.Offset(.ListIndex + 1, 0).Address(external:=True)
End If
End With
End Sub
Private Sub UserForm_Initialize()

Set myRng = Worksheets("sheet1").Range("a1:a10")

With Me.ComboBox1
.Style = fmStyleDropDownList
.RowSource = myRng.Address(external:=True)
End With

End Sub




Alvin Hansen wrote:

Hi
i have this in a userform . combobox
Dim myrange3 As Range
On Error Resume Next

Set myrange3 =
Sheets(Range("kurt!$h$1").Value).Range(Range("kurt !$h$1").Value)
On Error GoTo 0
If myrange3 Is Nothing Then
MsgBox ("Ingen mapper i Gruppen")
Exit Sub
End If
For Each c In myrange3
kursist2.AddItem c.Text

Next
The same code is in another combobox and the get the same value but can't i
say that the second combobox shall start in the range after the first
combobox choice.

Maybe this is better
RAnge = 1-2-3-4-5-6-7-8-9-10 ..............
I make my choice in combobox1 and take 5 as value
Then i want my second combobox to start at 6 not again from 1
Can i do that?

Regards
alvin


--

Dave Peterson
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
fill combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
OT :Start your own online business today !start making dollars [email protected] Excel Discussion (Misc queries) 0 May 6th 06 09:29 PM
Start spreadsheet with WinXP start Gordon Gradwell Excel Worksheet Functions 1 July 13th 05 11:35 AM
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox Minitman[_4_] Excel Programming 3 October 26th 04 07:58 PM
ComboBox start condition Don Excel Programming 2 June 29th 04 12:10 AM


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