Stealth Cyborg
Mitglied
Hallo,
ich habe folgendes Problem:
Ich hab hier ein Makro-Quelltext und muss den verstehen! Das Problem ist ich hab noch nie in meinem ganzen Leben was mit Makros gemacht. Wäre cool wenn mir einer von euch den Erklären kann.... danke
Dim CurRow As Integer
For i = 1 To 231 Step 5
If Cells(3, i) = "" Then
CurRow = i
Exit For
End If
Next i
CellCharLeft = Int(CurRow / 26)
CellCharRight = Chr(65 + CurRow - CellCharLeft)
If CellCharLeft > 0 Then
CellCharLeft = Chr(CellCharLeft)
CurColumn = CellCharLeft & CellCharRight
Else
CurColumn = CellCharRight
End If
Columns(CurColumn & ":" & CurColumn).Select
Selection.Insert Shift:=xlToLeft
Selection.Insert Shift:=xlToLeft
Selection.Insert Shift:=xlToLeft
Selection.Insert Shift:=xlToLeft
Selection.Insert Shift:=xlToLeft
Sheets("Vorlage").Select
Range("A1:E12").Select
Selection.Copy
Sheets("Januar").Select
Cells(3, CurRow).Select
ActiveSheet.Paste
Cells(4, CurRow + 6).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-3]"
Cells(5, CurRow + 7).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-3]"
Cells(6, CurRow + 7).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-3]"
Cells(7, CurRow + 7).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-3]"
Cells(8, CurRow + 7).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-3]"
Cells(9, CurRow + 7).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-3]"
Cells(5, CurRow + 8).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-5]-RC[-4]"
Cells(6, CurRow + 8).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-5]-RC[-4]"
Cells(7, CurRow + 8).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-5]-RC[-4]"
Cells(8, CurRow + 8).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-5]-RC[-4]"
Cells(9, CurRow + 8).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-5]-RC[-4]"
End Sub
ich habe folgendes Problem:
Ich hab hier ein Makro-Quelltext und muss den verstehen! Das Problem ist ich hab noch nie in meinem ganzen Leben was mit Makros gemacht. Wäre cool wenn mir einer von euch den Erklären kann.... danke
Dim CurRow As Integer
For i = 1 To 231 Step 5
If Cells(3, i) = "" Then
CurRow = i
Exit For
End If
Next i
CellCharLeft = Int(CurRow / 26)
CellCharRight = Chr(65 + CurRow - CellCharLeft)
If CellCharLeft > 0 Then
CellCharLeft = Chr(CellCharLeft)
CurColumn = CellCharLeft & CellCharRight
Else
CurColumn = CellCharRight
End If
Columns(CurColumn & ":" & CurColumn).Select
Selection.Insert Shift:=xlToLeft
Selection.Insert Shift:=xlToLeft
Selection.Insert Shift:=xlToLeft
Selection.Insert Shift:=xlToLeft
Selection.Insert Shift:=xlToLeft
Sheets("Vorlage").Select
Range("A1:E12").Select
Selection.Copy
Sheets("Januar").Select
Cells(3, CurRow).Select
ActiveSheet.Paste
Cells(4, CurRow + 6).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-3]"
Cells(5, CurRow + 7).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-3]"
Cells(6, CurRow + 7).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-3]"
Cells(7, CurRow + 7).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-3]"
Cells(8, CurRow + 7).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-3]"
Cells(9, CurRow + 7).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-3]"
Cells(5, CurRow + 8).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-5]-RC[-4]"
Cells(6, CurRow + 8).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-5]-RC[-4]"
Cells(7, CurRow + 8).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-5]-RC[-4]"
Cells(8, CurRow + 8).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-5]-RC[-4]"
Cells(9, CurRow + 8).Select: ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+RC[-5]-RC[-4]"
End Sub