J
Junior728
Hi,
How can i shorten the scripts below so that once it reach every 26th row, it
will perform certain tasks. Currently, i am manual adding the row no for next
26th row. Pls help.
Sheets("Format").Select 'Format got header, start frm Row 2.
Range("A1").Select
NumOfRows = Cells(Rows.Count, 1).End(xlUp).Row
For CurrentRow = 2 To NumOfRows
If CurrentRow = 2 Then
Rows(CurrentRow).Select
Selection.Insert Shift:=xlDown
Cells(CurrentRow, "C").Select
ActiveCell.FormulaR1C1 = "CIS053"
Cells(CurrentRow, "A").Select
ActiveCell.FormulaR1C1 = "H"
End If
If CurrentRow = 29 Then
Rows(CurrentRow).Select
Selection.Insert Shift:=xlDown
Cells(CurrentRow, "C").Select
ActiveCell.FormulaR1C1 = "CIS053"
Cells(CurrentRow, "A").Select
ActiveCell.FormulaR1C1 = "H"
End If
If CurrentRow = 56 Then
Rows(CurrentRow).Select
Selection.Insert Shift:=xlDown
Cells(CurrentRow, "C").Select
ActiveCell.FormulaR1C1 = "CIS053"
Cells(CurrentRow, "A").Select
ActiveCell.FormulaR1C1 = "H"
End If
If CurrentRow = 83 Then
Rows(CurrentRow).Select
Selection.Insert Shift:=xlDown
Cells(CurrentRow, "C").Select
ActiveCell.FormulaR1C1 = "CIS053"
Cells(CurrentRow, "A").Select
ActiveCell.FormulaR1C1 = "H"
End If
If CurrentRow = 110 Then
Rows(CurrentRow).Select
Selection.Insert Shift:=xlDown
Cells(CurrentRow, "C").Select
ActiveCell.FormulaR1C1 = "CIS053"
Cells(CurrentRow, "A").Select
ActiveCell.FormulaR1C1 = "H"
End If
If CurrentRow = 137 Then
Rows(CurrentRow).Select
Selection.Insert Shift:=xlDown
Cells(CurrentRow, "C").Select
ActiveCell.FormulaR1C1 = "CIS053"
Cells(CurrentRow, "A").Select
ActiveCell.FormulaR1C1 = "H"
End If
If CurrentRow = 164 Then
Rows(CurrentRow).Select
Selection.Insert Shift:=xlDown
Cells(CurrentRow, "C").Select
ActiveCell.FormulaR1C1 = "CIS053"
Cells(CurrentRow, "A").Select
ActiveCell.FormulaR1C1 = "H"
End If
Next
How can i shorten the scripts below so that once it reach every 26th row, it
will perform certain tasks. Currently, i am manual adding the row no for next
26th row. Pls help.
Sheets("Format").Select 'Format got header, start frm Row 2.
Range("A1").Select
NumOfRows = Cells(Rows.Count, 1).End(xlUp).Row
For CurrentRow = 2 To NumOfRows
If CurrentRow = 2 Then
Rows(CurrentRow).Select
Selection.Insert Shift:=xlDown
Cells(CurrentRow, "C").Select
ActiveCell.FormulaR1C1 = "CIS053"
Cells(CurrentRow, "A").Select
ActiveCell.FormulaR1C1 = "H"
End If
If CurrentRow = 29 Then
Rows(CurrentRow).Select
Selection.Insert Shift:=xlDown
Cells(CurrentRow, "C").Select
ActiveCell.FormulaR1C1 = "CIS053"
Cells(CurrentRow, "A").Select
ActiveCell.FormulaR1C1 = "H"
End If
If CurrentRow = 56 Then
Rows(CurrentRow).Select
Selection.Insert Shift:=xlDown
Cells(CurrentRow, "C").Select
ActiveCell.FormulaR1C1 = "CIS053"
Cells(CurrentRow, "A").Select
ActiveCell.FormulaR1C1 = "H"
End If
If CurrentRow = 83 Then
Rows(CurrentRow).Select
Selection.Insert Shift:=xlDown
Cells(CurrentRow, "C").Select
ActiveCell.FormulaR1C1 = "CIS053"
Cells(CurrentRow, "A").Select
ActiveCell.FormulaR1C1 = "H"
End If
If CurrentRow = 110 Then
Rows(CurrentRow).Select
Selection.Insert Shift:=xlDown
Cells(CurrentRow, "C").Select
ActiveCell.FormulaR1C1 = "CIS053"
Cells(CurrentRow, "A").Select
ActiveCell.FormulaR1C1 = "H"
End If
If CurrentRow = 137 Then
Rows(CurrentRow).Select
Selection.Insert Shift:=xlDown
Cells(CurrentRow, "C").Select
ActiveCell.FormulaR1C1 = "CIS053"
Cells(CurrentRow, "A").Select
ActiveCell.FormulaR1C1 = "H"
End If
If CurrentRow = 164 Then
Rows(CurrentRow).Select
Selection.Insert Shift:=xlDown
Cells(CurrentRow, "C").Select
ActiveCell.FormulaR1C1 = "CIS053"
Cells(CurrentRow, "A").Select
ActiveCell.FormulaR1C1 = "H"
End If
Next