Hello members,
I need help modifying the VBA code to skip a cell in the first row of each set of rows.
The lines highlighted in yellow are the first lines of the set, and every set contain 6 row. When i start entering the data on the first row, i want excel to skip A6 and move to A7 (Only for the yellow highlighted rows). The rest of the rows of each set should be as the same as in the attached photo.
Thank you.
I need help modifying the VBA code to skip a cell in the first row of each set of rows.
The lines highlighted in yellow are the first lines of the set, and every set contain 6 row. When i start entering the data on the first row, i want excel to skip A6 and move to A7 (Only for the yellow highlighted rows). The rest of the rows of each set should be as the same as in the attached photo.
Thank you.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
'ESTABLISH THE COLUMN AND ROW DIGITS
Dim tAd As Variant
tAd = Split(Target.Address, "$")
'tAd(1) BECOMES THE COLUMN LETTER
'tAd(2) BECOMES THE ROW NUMBER
'ESTABLISH THE REMAINDER OF THE ROW NUMBER DIVIDED BY 5
Dim rowRemainder As Long
rowRemainder = tAd(2) Mod 6
'IF THE COMPLETED ENTRY IS IN COLUMN A
If tAd(1) = "B" Then
Range("C" & Target.Row).Activate
'...IN COLUMN C
ElseIf tAd(1) = "C" Then
Range("D" & Target.Row).Activate
'...IN COLUMN D
ElseIf tAd(1) = "D" Then
Range("E" & Target.Row).Activate
'...IN COLUMN E
ElseIf tAd(1) = "E" Then
Range("F" & Target.Row).Activate
'...IN COLUMN F
ElseIf tAd(1) = "F" Then
Range("G" & Target.Row).Activate
'IF IN THE LAST ROW OF THE SET
If rowRemainder = 1 Then
Range("B" & Target.Row + 1).Activate
'OTHERWISE IN THE UPPER PART OF THE SET
Else
Range("D" & Target.Row + 1).Activate
End If
End If
End Sub