View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Getting the columnmeads

Maybe this'll give you an idea:

Option Explicit
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub CommandButton2_Click()
Dim myRange1 As Range
Set myRange1 = Sheets("ark1").Range("navne")
With kurtype
If .ListIndex < 0 Then
'nothing selected
Else
MsgBox .ListIndex & "--" & .Value & _
vbLf & myRange1.Cells(1).Offset(0, .ListIndex).Column
End If
End With
End Sub
Private Sub UserForm_Initialize()
Dim myRange1 As Range
Dim a As Range
Set myRange1 = Sheets("ark1").Range("navne")
For Each a In myRange1
kurtype.AddItem a.Text
Next
End Sub


alvin Kuiper wrote:

Hi
I use this to make the values in a combobox
Dim myrange1 As Range

Set myrange1 = Sheets("ark1").Range("navne")
For Each a In myrange1
kurtype.AddItem a.Text
Next

The range("navn") is a namerange there taking all the values in row 1
In my combo box i want to see the values i have this is what i also have
today
but when i choose one value in my combobox i want to get the columnname as a
value in a variable or something like that

Hope someone understand

Regards
Alvin


--

Dave Peterson