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

Verständnisfrage

Forumthread: Verständnisfrage

Verständnisfrage
RainerK
Hallo,
habe für eine UserForm folgende Initialisierung.
Private Sub UserForm_Initialize()
Dim IntS As Integer
Dim wks As Worksheet
Set wks = Worksheets("BS")
With ListBox1
.Font.Size = 9
.ForeColor = RGB(0, 0, 255)
.ColumnCount = 11
.ColumnWidths = ("4,6cm;3,3cm;2,9cm;0;0;1,8cm;2,8cm;0;0;2cm;1cm")
.Clear
For IntS = 7 To wks.Range("IV4").End(xlToLeft).Column
If Cells(13, IntS) > "" Then
.AddItem wks.Cells(4, IntS) & " • " & wks.Cells(5, IntS)
'.List(.ListCount - 1, 1) = wks.Cells(5, IntS)
.List(.ListCount - 1, 1) = wks.Cells(9, IntS)
.List(.ListCount - 1, 2) = Format(wks.Cells(21, IntS), "#,##0.00")
.List(.ListCount - 1, 3) = Format(wks.Cells(23, IntS), "#,##0.00")
.List(.ListCount - 1, 4) = Format(wks.Cells(25, IntS), "#,##0.00")
.List(.ListCount - 1, 5) = Format(wks.Cells(26, IntS), "#,##0.00")
.List(.ListCount - 1, 6) = Format(wks.Cells(32, IntS), "#,##0.00")
.List(.ListCount - 1, 7) = Format(wks.Cells(33, IntS), "#,##0.00")
.List(.ListCount - 1, 8) = Format(wks.Cells(34, IntS), "#,##0.00")
.List(.ListCount - 1, 9) = Format(wks.Cells(35, IntS), "#,##0.00") & " €    "
End If
Next IntS
End With
End Sub
Mit Set wks müsste die UserForm doch von jedem beliebigen Tabellenblatt aus aufgerufen werden können oder habe ich irgendwo noch ein "wks" vergessen?
Leider klappt der Aufruf nur, wenn ich im Arbeitsblatt "BS" bin.
Gruß Rainer
Anzeige

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

Betreff
Benutzer
Anzeige
AW: Verständnisfrage
30.08.2010 15:41:27
Hajo_Zi
Hallo Rainer,
vielleicht hier

If Cells(13, IntS) > ""

es fehlt am Ende Set Wks=Nothing

AW: Verständnisfrage
30.08.2010 16:28:28
RainerK
Hallo Hajo,
danke, das war's gewesen.
Gruß Rainer
Anzeige
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