AW: Rätselhafte Fehlermeldung Modul Tab 63?
28.09.2020 14:05:54
Ulli
Hallo Herbert,
danke für deinen Imput. Ich hab das betroffene Modul auch schon komplett durch geklickt. Es funktioniert alles einwandfrei. Hatte eventuell den Verdacht dass es an einem kaputten Verweis liegt (also 32 bit System statt 64 bit --> die richtige Bibliothek kann nicht gefunden werden o.ä.).
Aber das ist halt schwer zu durchschauen...hab leider nur das Feedback von einem Anwender bekommen ohne selber rein schauen zu können.
Hier ist noch mal der gesamte Code in Tab 63:
Wie gesagt, bei mir und bislang auch auf allen anderen PC´s hats einwandfrei funktioniert...nur eben nicht dieses mal beim Kunden XY...
Private Sub ComboBox1_Change()
Application.ScreenUpdating = False
If ComboBox1.Value = "" Then
Exit Sub
End If
Application.ScreenUpdating = True
End Sub
Private Sub ComboBox2_Change()
Application.ScreenUpdating = False
If ComboBox2.Value = "konventionell" Then
Range("G9").Value = 1
End If
If ComboBox2.Value = "ökologisch" Then
Range("G9").Value = 2
End If
If ComboBox2.Value = "" Then
Range("G9").Value = 0
End If
Application.ScreenUpdating = True
End Sub
Private Sub ComboBox5_Change()
Application.ScreenUpdating = False
If ComboBox5.Value = "Laubwald" Then
Range("F17").Value = 1
End If
If ComboBox5.Value = "Nadelwald" Then
Range("F17").Value = 2
End If
If ComboBox5.Value = "Mischwald" Then
Range("F17").Value = 3
End If
If ComboBox5.Value = "" Then
Range("F17").Value = 0
End If
Application.ScreenUpdating = True
End Sub
Private Sub ComboBox7_Change()
If ComboBox7.Value = "Laubwald" Then
Range("F18").Value = 1
End If
If ComboBox7.Value = "Nadelwald" Then
Range("F18").Value = 2
End If
If ComboBox7.Value = "Mischwald" Then
Range("F18").Value = 3
End If
If ComboBox7.Value = "" Then
Range("F18").Value = 0
End If
Application.ScreenUpdating = True
End Sub
Private Sub ComboBox8_Change()
If ComboBox8.Value = "Laubwald" Then
Range("F19").Value = 1
End If
If ComboBox8.Value = "Nadelwald" Then
Range("F19").Value = 2
End If
If ComboBox8.Value = "Mischwald" Then
Range("F19").Value = 3
End If
If ComboBox8.Value = "" Then
Range("F19").Value = 0
End If
Application.ScreenUpdating = True
End Sub
Private Sub ComboBox9_Change()
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:="Klima2020"
If ComboBox9.Value = "Kein Wald" Or ComboBox9.Value = "" Then
Rows("17:20").EntireRow.Hidden = True
Range("C17:C19").Value = 0
End If
If ComboBox9.Value = "Laub-, Nadel- und Mischbestände" Then
Rows("17:20").EntireRow.Hidden = False
End If
If ComboBox9.Value = "Reinbestand" Then
Rows("18:19").EntireRow.Hidden = True
Rows("17").EntireRow.Hidden = False
Rows("20").EntireRow.Hidden = False
End If
ActiveSheet.Protect Password:="Klima2020"
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
If Range("B3") = "" Then
MsgBox ("Bitte geben Sie einen Betriebsnamen an!")
Range("B3").Select
Exit Sub
End If
If Range("B4").Value = "" Then
MsgBox ("Bitte geben Sie Ihre Anschrift an.")
Range("B4").Select
Exit Sub
End If
If Range("B5").Value = "" Then
MsgBox ("Bitte geben Sie das abgelaufene Wirtschaftsjahr an (z.B. 2019).")
Range("B5").Select
Exit Sub
End If
If ComboBox2.Value = "" Then
MsgBox ("Bitte wählen Sie Ihre Bewirtschaftungsart!")
Range("B9").Select
Exit Sub
End If
If CheckBox1.Value = False And CheckBox2.Value = False And CheckBox3.Value = False Then
MsgBox ("Bitte wählen Sie mindestens einen Bewirtschaftungstyp!")
Range("B10").Select
Exit Sub
End If
If ComboBox1.Value = "" Or ComboBox1.Value = 0 Then
MsgBox ("Bitte geben Sie die Anzahl an Schlägen für die eine Humusbilanz erstellt werden _
soll an!")
Range("B11").Select
Exit Sub
End If
For i = 1 To ComboBox1.Value
Sheets("F" & i).Visible = xlSheetVisible
Next i
If CheckBox1.Value = True Then
Worksheets("Grünland").Visible = True
Else: Worksheets("Grünland").Visible = False
End If
If CheckBox2.Value = True Or CheckBox3.Value = True Then
Worksheets("Ackerland").Visible = True
Else: Worksheets("Ackerland").Visible = False
End If
Speichern
NächsteSeite
Application.ScreenUpdating = True
End Sub
Sub Speichern()
Dim strVerzeichnis As String
Dim entscheidung As String
Dim strOrdner As String
Dim dateiname As String
Worksheets("Start").Unprotect Password:="Klima2020"
dateiname = "Klimabilanz_2019_" & Worksheets("Start").Range("B3").Value
msg = MsgBox("Soll die Datei zwischengespeichert werden?", vbYesNo)
If msg = vbYes Then
With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = strOrdner
.Title = "Ordnerauswahl"
.ButtonName = "Auswahl..."
.InitialView = msoFileDialogViewList
If .Show = -1 Then
strVerzeichnis = .SelectedItems(1)
If Right(strVerzeichnis, 1) "\" Then strVerzeichnis = strVerzeichnis & "\"
Else
MsgBox "Es wurde kein Ordner ausgewaehlt!"
Exit Sub
End If
End With
ActiveWorkbook.SaveAs (strVerzeichnis & dateiname)
MsgBox ("Die Datei wurde unter" & strVerzeichnis & " zwischengespeichert.")
Else
Exit Sub
End If
End Sub
Private Sub OptionButton10_Click()
Application.ScreenUpdating = False
Worksheets("Mutterkuhhaltung").Visible = False
Application.ScreenUpdating = True
End Sub
Private Sub OptionButton13_Click()
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:="Klima2020"
OptionButton7.Enabled = True
OptionButton8.Enabled = True
OptionButton9.Enabled = True
OptionButton10.Enabled = True
Rows("13:14").EntireRow.Hidden = False
ActiveSheet.Protect Password:="Klima2020"
Application.ScreenUpdating = True
End Sub
Private Sub OptionButton14_Click()
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:="Klima2020"
OptionButton7.Enabled = False
OptionButton8.Enabled = False
OptionButton9.Enabled = False
OptionButton10.Enabled = False
OptionButton8.Value = True
OptionButton10.Value = True
Rows("13:14").EntireRow.Hidden = True
ActiveSheet.Protect Password:="Klima2020"
Application.ScreenUpdating = True
End Sub
Private Sub OptionButton7_Click()
Application.ScreenUpdating = False
Worksheets("Milchvieh").Visible = True
Application.ScreenUpdating = True
End Sub
Private Sub OptionButton8_Click()
Application.ScreenUpdating = False
Worksheets("Milchvieh").Visible = False
Application.ScreenUpdating = True
End Sub
Private Sub OptionButton9_Click()
Application.ScreenUpdating = False
Worksheets("Mutterkuhhaltung").Visible = True
Application.ScreenUpdating = True
End Sub
Private Sub Worksheet_Activate()
Range("A1").Select
ActiveWindow.ScrollRow = Selection.Row
ActiveWindow.ScrollColumn = Selection.Column
End Sub