AW: Listbox Markierung aufheben
09.02.2016 10:42:06
Ludmila
Hallo Rudi,
leider funktioniert es nicht.
Jetzt kommt Fehler 70, Zugriff verweigert
Habe es mal ohne meine eigene MsgBox probiert
Hier mein gesamter Code:
Private Sub lstLRG_Click()
Set WkbD = Workbooks(sD)
Set WksRGJ = WkbD.Worksheets(RGJ)
Set WksNK = WkbD.Worksheets(NK)
With UFRG
For ii = 0 To .lstLRG.ListCount - 1
If .lstLRG.Selected(ii) Then
.lblRGZNr.Caption = .lstLRG.List(ii, 6)
End If
Next ii
lRe = .lblRGZNr.Caption
.lblRGAltNeu.Caption = "Alt"
End With
With WksRGJ
lSp = .Rows(1).Find(What:="RG_RGNR", LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows) _
.Column: UFRG.txtRGNr.Text = .Cells(lRe, lSp)
lSp = .Rows(1).Find(What:="RG_DATUM", LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:= _
xlByRows).Column: UFRG.cboRGDatum.Value = .Cells(lRe, lSp)
lSp = .Rows(1).Find(What:="RG_DATEI_NAME", LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:= _
xlByRows).Column: UFRG.lblRGAltDateixlsm.Caption = .Cells(lRe, lSp)
lSp = .Rows(1).Find(What:="RG_DATEI_NAME_PDF", LookIn:=xlValues, LookAt:=xlWhole, SearchOrder: _
=xlByRows).Column: UFRG.lblRGAltDateipdf.Caption = .Cells(lRe, lSp)
lSp = .Rows(1).Find(What:="RG_SSATZ", LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:= _
xlByRows).Column: UFRG.cboRGSteuerSatz.Value = .Cells(lRe, lSp)
lSp = .Rows(1).Find(What:="RG_ART", LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows). _
Column: UFRG.cboRGArt.Value = .Cells(lRe, lSp)
lSp = .Rows(1).Find(What:="RG_BL_KOMP", LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:= _
xlByRows).Column: UFRG.cboRGAnsp.Text = .Cells(lRe, lSp)
lSp = .Rows(1).Find(What:="RG_BL_ANREDE", LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:= _
xlByRows).Column: UFRG.txtRGAnspAnr.Text = .Cells(lRe, lSp)
lSp = .Rows(1).Find(What:="RG_BL_TITEL", LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:= _
xlByRows).Column: UFRG.txtRGAnspTitel.Text = .Cells(lRe, lSp)
lSp = .Rows(1).Find(What:="RG_BRIEF", LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:= _
xlByRows).Column: UFRG.txtRGBriefAnrede.Text = .Cells(lRe, lSp)
lSp = .Rows(1).Find(What:="RG_ZAHL_FAELLIG", LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:= _
xlByRows).Column: UFRG.txtRGZahlFaellig.Text = .Cells(lRe, lSp)
End With
Dim bytmsg As Byte
bytmsg = MsgBox("Ja, Nein oder Abbruch?", vbYesNoCancel, "Rechnung")
If bytmsg = vbYes Then
cmdZurRG = True
ElseIf bytmsg = vbNo Then
With WksNK
lRe = .Columns(1).Find(What:="RECHNUNGKREIS", LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByRows).Row
lSp = .Rows(1).Find(What:="NKKOMPLETT", LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:= _
xlByRows).Column
UFRG.txtRGNr.Text = .Cells(lRe, lSp)
End With
With UFRG
.lblRGAltNeu.Caption = "Alt1"
.lblRGZNr.Caption = ""
.cboRGArt.ListIndex = -1
.cboRGArt.SetFocus
End With
Else
UFRG.lstLRG.List = UFRG.lstLRG.List
Exit Sub
End If
End Sub
Danke!
Gruß
Ludmila