Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Anzeige
Inhaltsverzeichnis

Blätter in Inputbox

Forumthread: Blätter in Inputbox

Blätter in Inputbox
Uwe
Hallo,
ich will alle Blätter dynamisch in eine Inputbox ausgeben.
Ich habe eine halb-dynamische Version. Die Inputbox muss sich noch automatisch "verlängern"
(Je nach Blattanzahl)
Es sind max 12 Blätter
Public Sub Blattnamen()
Dim WkSh      As Worksheet
Dim vBlatt()  As String
Dim iIndx     As Integer
For Each WkSh In ThisWorkbook.Worksheets
ReDim Preserve vBlatt(iIndx)
vBlatt(iIndx) = WkSh.Name
iIndx = iIndx + 1
Next WkSh
'  For iIndx = LBound(vBlatt) To UBound(vBlatt)
'     MsgBox vBlatt(iIndx)
'  Next iIndx
Dim sAdr As String
nocheinmal:
sAdr = InputBox("Welches Blatt?" & vbNewLine & vbNewLine & _
"1.   >>> " & vBlatt(0) & vbNewLine & _
"2.   >>> " & vBlatt(1) & vbNewLine & _
"3.   >>> " & vBlatt(2) & vbNewLine & _
'hier sollen sich dann die Zeilen untereinander je nach Blattanzahl abbauen
"99.   >>> Abbruch KEIN", "Blatt auswählen", 1)
If Not IsNull(sAdr) And sAdr  "" And IsNumeric(sAdr) Then
If sAdr = 99 Then Exit Sub
If sAdr 

Anzeige

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Benutzer
Anzeige
AW: Blätter in Inputbox
19.07.2011 13:27:06
Rudi
Hallo,
Public Sub Blattnamen()
Dim WkSh      As Worksheet
Dim vBlatt()  As String
Dim iIndx     As Integer
Dim strInput As String
Dim sAdr As String
ReDim vBlatt(Worksheets.Count - 1)
For Each WkSh In ThisWorkbook.Worksheets
vBlatt(iIndx) = WkSh.Name
iIndx = iIndx + 1
Next WkSh
strInput = "Welches Blatt?" & vbNewLine & vbNewLine
For iIndx = LBound(vBlatt) To UBound(vBlatt)
strInput = strInput & iIndx + 1 & ".     >>> " & vBlatt(iIndx) & vbLf
Next iIndx
strInput = strInput & "99.   >>> Abbruch KEIN"
nocheinmal:
sAdr = InputBox(strInput, "Blatt auswählen", 1)
If Not IsNull(sAdr) And sAdr  "" And IsNumeric(sAdr) Then
If sAdr = 99 Then Exit Sub
If sAdr > Worksheets.Count Then
MsgBox "Fehler bei der Blatteingabe": GoTo nocheinmal
End If
End If
End Sub

Gruß
Rudi
Anzeige
AW: Blätter in Inputbox - danke
19.07.2011 13:30:23
Uwe
Danke Rudi,
perfekt
Gruss
Uwe
Anzeige
Anzeige
Live-Forum - Die aktuellen Beiträge
Datum
Titel
14.05.2026 13:31:09
14.05.2026 09:50:42
13.05.2026 19:14:18