Laufzeifehler 1004 HILFE!!!!
15.03.2013 13:18:01
Michael
habe ein makro in vba editor programmiert.
wenn ich im editor mit f8 das makro abrufe, funkt alles.
geh ich aber in mein excel sheet auf entwicklungstools, makros (und rufe mein makro auf) funkt leide rnichts mehr.
was mach ich falsch, bitt um eure Hilfe!!!
Sub LOG_File_Makro()
'Sicherstellen, dass ich auf dem richtigen Arbeitsblatt bin
ThisWorkbook.Worksheets(1).Activate
'Bedingete Formatierung der Zelle A3
'Zelleninhalt A3:
'"GESPERRT";
'Schriftart ARIAL, FETT, Größe 28, Ausrichtung ZENTRIERT, Schriftfarbe WEIß
'Hintergrundfarbe rot RGB=(255,0,0)
'Zelleninhalt "A3" in Grossbuchstaben umwandeln
Dim Zelle As Range
For Each Zelle In Range("A3")
Zelle = UCase(Zelle.Value)
Next Zelle
'Allgemeine Zellenformatierung für "A3"
'Anordnung mittig, Schriftart Arial, Größe 28
Range("A3").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.ReadingOrder = xlContext
End With
With Selection.Font
.Name = "Arial"
.Size = 28
End With
'bedingte Formatierung für Zelleninhalt "A3" "FREIGABE"
'Schriftfarbe schwarz, Hintergrund grün RGB(79, 249, 39)
Selection.FormatConditions.Add Type:=xlTextString, String:="FREIGABE", _
TextOperator:=xlContains
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Bold = True
.Color = RGB(0, 0, 0)
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = RGB(79, 249, 39)
End With
'bedingte Formatierung für Zelleninhalt "A3" "GESPERRT"
'Schriftfarbe weiß RGB(255, 255, 255), Hintergrund rot Color = 255
Selection.FormatConditions(1).StopIfTrue = False
Selection.FormatConditions.Add Type:=xlTextString, String:="GESPERRT", _
TextOperator:=xlContains
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Bold = True
.Color = RGB(255, 255, 255)
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 255
End With
Selection.FormatConditions(1).StopIfTrue = False
'Abfrage ob der Zeileninhalt aktualisiert ist
Dim MsgBoxA As String
MsgBoxA = MsgBox("Ist das Feld A3 aktualisiert?")
'File speichern
Dim Zelleninhalt_A As String
Dim Log As String
Dim TB As String
Zelleninhalt_A = Range("A3")
Log = Left(Range("A1"), 3)
TB = Left(Range("C3"), 8)
'Makro speichern auf meinem Desktop
If Zelleninhalt_A = "GESPERRT" Then
ActiveWorkbook.SaveAs Filename:="C:\Users\michael\Desktop\" & Zelleninhalt_A & "_" & _
Log & "_" & TB, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Else
ActiveWorkbook.SaveAs Filename:="C:\Users\michael\Desktop\" & Log & "_" & TB, FileFormat: _
_
=xlOpenXMLWorkbook, CreateBackup:=False
End If
End Sub
DANKE im Voraus!