I've been working Worksheet_Change VBA code in Excel as shown below.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A2:A2000")) Is Nothing Then
Call writetag
End If
End Sub
Sub writetag()
ActiveCell.Select
ActiveCell.Offset(0, 1).Select
ActiveCell.Formula = "1st Request"
End Sub
The writetag
VBA code alone does its job just fine wherein it would move 1 cell to the right of the active cell and write "1st Request". Then I have the first VBA code - Worksheet_Change
- that will trigger the writetag
code whenever there are changes made on range A2:A2000.
But it is at this part that the writetag
code does not work perfectly. Instead of moving 1 cell to the right, it would move 1 cell to the right and another 1 cell below. So I need to adjust ActiveCell.Offset(0, 1).Select
to ActiveCell.Offset(-1, 1).Select
just so that it would move to the right cell.
Then after that, I would like to make 3 conditions or Ifs, wherein when I put 1 anywhere on the A2:A2000 range, it will put "1st Request" to its right. If I put 2 anywhere on the range, it will put "2nd Request" to its right, "3rd Request" if I put 3.
Thank you so much for the help.