Gibt es eine Möglichkeit die Listbox zu öffnen so das der Cursor auf der letzten ausgewählten Position steht und nicht ganz oben ?
lg.Ernst
Private Sub UserForm_Activate()
' Listbox füllen
Dim i As Integer
Dim wks1 As Worksheet
Set wks1 = Worksheets("Zawadil+Entwerter")
For i = 9 To 702 Step 1
ListBox1.AddItem (wks1.Cells(i, 1).MergeArea.Cells(1, 1).Value)
Next i
' Optionbutton1 aktivieren
Me.OptionButton1 = True
End Sub
lg.Ernst
Private Sub UserForm_Initialize()
Set wsActive = ActiveSheet
CancelButton = 0
'Clear controls for next entry and set default box
'TextShares.Value = ""
'TextPrice.Text = ""
'Populate text boxes with data from the spreadsheet
With CBRegion
.AddItem "APAC"
.AddItem "China"
.AddItem "MEA"
.AddItem "NE"
.AddItem "NA"
.AddItem "SA"
.AddItem "SWE"
End With
CBRegion.Value = Worksheets("reportGenerator").Range("a6").Value
'Set the Report input file/default
If Range("ReportGenerator!A2").Value = "" Then
TxtReportPath.Text = Range("ReportGenerator!A4").Value
Else
TxtReportPath.Text = Range("ReportGenerator!A2").Value
End If
'Set the Report store path/default
If Range("ReportGenerator!A3").Value = "" Then
TxtStorePath.Text = Range("ReportGenerator!A4").Value
Else
TxtStorePath.Text = Range("ReportGenerator!A3").Value
End If
'Set the Report template file
If Range("ReportGenerator!A5").Value = "" Then
TxtRepTemplate.Text = Range("ReportGenerator!A4").Value
Else
TxtRepTemplate.Text = Range("ReportGenerator!A5").Value
End If
'Set the reporting period (as actual month)
TxtRepperiod.Text = CStr(Month(Date))
TxtReportPath.SetFocus
End Sub
Anbei noch ein Screenprint des Userforms:
Ich hoffe das hilft Dir weiter.
Gruss
Dirk aus Dubai
Private Sub UserForm_Activate()
' Listbox füllen
Dim i As Integer
Dim wks1 As Worksheet
Set wks1 = Worksheets("Zawadil+Entwerter")
For i = 9 To 702 Step 1
Me.ListBox1.AddItem (wks1.Cells(i, 1).MergeArea.Cells(1, 1).Value)
Next i
Me.ListBox1.ListIndex = Me.ListBox1.ListCount - 1
' Optionbutton1 aktivieren
Me.OptionButton1 = True
End Sub
Gruß Uwe