ich habe einen Code, der mir alle Zeilen, außer die Zeile 10 einfriert (Formeln durch Werte ersetzt). Nun möchte ich aber, dass auch Zeile 11 und 135 nicht eingefroren werden.
Ich stell mich anscheinend zu blöd, denn wenn ich versuche am Code zu basteln, friert er wieder _
alle Zeilen ein:
Function Monat_einfrieren(Ziel As String, Quelle As String)
Dim lastrow As Long
Dim Spalte As Long, lastColumn As Long
Dim strMonat As String
Dim wsZiel As Worksheet
Set wsZiel = Worksheets(Ziel)
strMonat = Worksheets(Quelle).Range("C33")
With Worksheets(Ziel)
If MsgBox("Daten für Monat """ & strMonat & """ in Tabelenblatt """ & .Name & """ _
einfrieren?", vbQuestion + vbOKCancel, "Monatsdaten einfrieren") = vbCancel Then Exit Function
lastColumn = .Cells(1, .Columns.Count).End(xlToLeft).Column 'Monate in Zeile 9
Application.ScreenUpdating = False
For Spalte = 4 To lastColumn
If Left(.Cells(1, Spalte), Len(strMonat)) = strMonat Then 'Monate in Zeile 9
lastrow = .Cells(.Rows.Count, Spalte).End(xlUp).Row
If lastrow > 4 Then
varFormula = .Cells(10, Spalte).Formula
With .Range(.Cells(10, Spalte), .Cells(.Rows.Count, Spalte).End(xlUp)) _
_
.Value = .Value
End With
.Cells(10, Spalte).Formula = varFormula
End If
End If
Next
Application.ScreenUpdating = True
End With
End Function
Kann mir jemand helfen?