I have a script that once I put something in a cell in column G, it automatically drops the current date/time into the next cell in column H. It runs as follows:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim C As Range, T As Range
Set T = Target
Set C = Range("G:G")
If Intersect(T, C) Is Nothing Then Exit Sub
If T.Offset(0, 1).Value <> "" Then Exit Sub
Application.EnableEvents = False
T.Offset(0, 1).Value = Now
Application.EnableEvents = True
End Sub
Well, now I need to do that again, on the same spreadsheet. I tried just copying and pasting the code over again, and chaing the range and the offset, but I get an "Ambiguous Name" error. I am assuming that's because the Subs have the same name, but if I change it, it doesn't work at all. What do I need to change the script to to allow me to run in for a separate, but similar operation, in a difference cell?
In this case, I want the Range to be J:J, and kick 31 cells over. At the same time, I want it to only activate if the letter dropped in is "X".
Any ideas?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim C As Range, T As Range
Set T = Target
Set C = Range("G:G")
If Intersect(T, C) Is Nothing Then Exit Sub
If T.Offset(0, 1).Value <> "" Then Exit Sub
Application.EnableEvents = False
T.Offset(0, 1).Value = Now
Application.EnableEvents = True
End Sub
Well, now I need to do that again, on the same spreadsheet. I tried just copying and pasting the code over again, and chaing the range and the offset, but I get an "Ambiguous Name" error. I am assuming that's because the Subs have the same name, but if I change it, it doesn't work at all. What do I need to change the script to to allow me to run in for a separate, but similar operation, in a difference cell?
In this case, I want the Range to be J:J, and kick 31 cells over. At the same time, I want it to only activate if the letter dropped in is "X".
Any ideas?