AW: Löschen von Zellinhalten
08.03.2017 13:58:30
Zellinhalten
Hallo Herbert,.
klappt nicht.
Da wird nichts ausgeblendet und ausgegraut,
und auch SHIF - STRG - F10 bringt nur ne Fehlermeldung, die lautet: Laufzeitfehler '1004': Die Hidden-Eigentschaft des Range-Objektes kann nicht festgelegt werden.
Geh ich dann auf Debuggen, moniert er die Zeile
Cells.EntireRow.Hidden = False
im Modul 2, in das ich Deinen Code kopiert hab.
Geht einfach nicht, kein Ausblenden, kein Ein- oder Ausblenden, nichts.
Naja vielleicht hast ja noch ne Idee?
Ich füg Dir einfach mal meine nach Deinen Anweisungen geänderten Codes an:
Arbeitsmappe - Tabelle 1:
Option Explicit
Private Sub Worksheet_Activate()
Dim iLastRow%
On Error GoTo ende
iLastRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Rows(iLastRow & ":1048576").EntireRow.Hidden = True
ende:
End Sub
Private Sub CommandButton1_Click()
Call SearchAllTables
End Sub
Private Sub CommandButton2_Click()
Call Ausdrucken
End Sub
Private Sub CommandButton3_Click()
Call Beenden
End Sub
Private Sub CommandButton4_Click()
ActiveWorkbook.FollowHyperlink "C:\Sonderanforderung Lager.pdf", NewWindow:=True
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column 2 Then Exit Sub
If Cells(Target.Row, Target.Column).Value > Cells(Target.Row, Target.Column + 3).Value _
Then
Application.EnableEvents = False
Target.Value = Cells(Target.Row, Target.Column + 3).Value
MsgBox "Höchstbestellmenge überschritten - Auf maximale Anzahl reduziert"
Application.EnableEvents = True
End If
End Sub
Diese Arbeitsmappe:
'Option Explicit
Private Sub Workbook_Open()
Application.OnKey "+^{F10}", "ZeilenEinblenden"
With UserForm1
'Start-Formular formatieren
.StartUpPosition = 1
.Height = Application.Height / 1
.Width = Application.Width / 1
.ComboBox1.Left = (.Width - .ComboBox1.Width) / 2 + (.ComboBox1.Width) - Application. _
CentimetersToPoints(3)
.ComboBox1.Top = Application.CentimetersToPoints(10)
.ComboBox2.Left = (.Width - .ComboBox2.Width) / 2 + (.ComboBox2.Width) - Application. _
_
CentimetersToPoints(3)
.ComboBox2.Top = Application.CentimetersToPoints(13)
.ComboBox2.Visible = False
.CommandButton1.Top = Application.CentimetersToPoints(14)
.CommandButton1.Left = (.Width - .CommandButton1.Width) / 2
.btnBeenden.Top = Application.CentimetersToPoints(14)
.btnBeenden.Left = (.Width + .btnBeenden.Width) / 2 + Application.CentimetersToPoints( _
3) _
.Image1.Left = (.Width - .Image1.Width) / 2
.Image1.Top = Application.CentimetersToPoints(1)
.Label1.Left = (.Width - .Label1.Width) / 2
.Label1.Top = Application.CentimetersToPoints(7)
.Label2.Left = (.Width - .Label2.Width) / 2 - (.Label2.Width) + Application. _
CentimetersToPoints(4)
.Label2.Top = Application.CentimetersToPoints(10)
.Label3.Left = (.Width - .Label3.Width) / 2 - (.Label3.Width) + Application. _
CentimetersToPoints(3)
.Label3.Top = Application.CentimetersToPoints(13)
.Label3.Visible = False
.Label4.Left = Application.CentimetersToPoints(1)
.Label4.Top = .Height - 18 - .Label4.Height - Application.CentimetersToPoints(1)
.Show
End With
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Environ("USERNAME") = "1HG" Then Exit Sub
Application.OnKey "+^{F10}"
If ActiveSheet.Range("A1").Value "Sicher" Then
MsgBox "Zum Beenden benutzen Sie bitte ausschließlich den 'Beenden'-Button"
Cancel = True
Else
ActiveSheet.Range("A1").Value = ""
ActiveSheet.Protect (Passwort)
ThisWorkbook.Saved = True
End If
End Sub
Private Sub Workbook_Activate()
Application.OnKey "+^{F10}", "ZeilenEinblenden"
End Sub
Private Sub Workbook_Deactivate()
Application.OnKey "+^{F10}"
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Environ("USERNAME") = "1HG" Then Exit Sub
frmPasswort.Show
If PW PasswortA Then
MsgBox "Sie sind nicht befugt, Änderungen abzuspeichern" & _
vbLf & "Ihre Änderungen werden nicht gesichert!", _
vbExclamation
PW = ""
Cancel = True
Application.DisplayAlerts = False
End If
End Sub
Modul 2:
Option Explicit
Sub ZeilenAusblenden()
Dim iLastRow%
iLastRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Rows(iLastRow & ":1048576").EntireRow.Hidden = True
End Sub
Sub ZeilenEinblenden()
Cells.EntireRow.Hidden = False
End Sub
Vielleicht hilft das weiter.
Schöne Grüße
Jochen