Ich möchte gerne im unteren Code nach der MsgBox "Werte wurden eingetragen!"
das die Arbeitsmappe gespeichert wird.
Habe es mit "ActiveWorkbook.Save" probiert, aber die Arbeitsmappe wird nicht gespeichert.
Könnte mir bitte jemand weiterhelfen.
Gruß
Heinz
Option Explicit
Dim UF As New CUserForm
Dim Gelesen As Boolean
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Sheets("Artikeln").Unprotect Password:="test"
Dim a As Long, myRow
If TextBox27 = "" Then
MsgBox "Es wurde keine SAP Nummer eingegeben." ', vbCritical
TextBox27.SetFocus
TextBox27.Text = ""
TextBox29.Text = ""
TextBox30.Text = ""
TextBox31.Text = ""
TextBox32.Text = ""
MsgBox "Es wurde nichts übernommen." ', vbCritical
Exit Sub
Else
With Worksheets("Artikeln") 'Anpassen
myRow = Application.Match(CSng(TextBox27), .Columns(1), 0)
If IsNumeric(myRow) Then
For a = 1 To 26
If IsNumeric(Me("ComboBox" & a)) Then
.Cells(myRow, a + 26) = CDbl(Me("ComboBox" & a).Value)
Else
.Cells(myRow, a + 26) = Me("ComboBox" & a).Value
End If
Next a
Else
MsgBox "SAP-Nr. " & TextBox27 & vbLf & "ist nicht vorhanden", vbCritical
MsgBox "Es wurde nichts übernommen." ', vbCritical
TextBox27.SetFocus
TextBox27.Text = ""
TextBox29.Text = ""
TextBox30.Text = ""
TextBox31.Text = ""
TextBox32.Text = ""
Exit Sub
End If
End With
End If
Sheets("Artikeln").Protect Password:="test"
MsgBox "Werte wurden eingetragen!"
ActiveWorkbook.Save
MsgBox "Wurde gespeichert"
'Unload Pruefung
For a = 1 To 26
Me("ComboBox" & a).Value = ""
Next a
TextBox27.SetFocus
TextBox27.Text = ""
TextBox29.Text = ""
TextBox30.Text = ""
TextBox31.Text = ""
TextBox32.Text = ""
Application.ScreenUpdating = True
End Sub