lintcollector
New Member
- Joined
- Mar 31, 2016
- Messages
- 2
I'm new to VBA, and any recommendations on where to learn more would be greatly appreciated.
I have a spreadsheet where various employee's will fill in the date the complete their assignment, then it flows to the next person. I am trying to use VBA to create a "username" stamp for multiple columns.
This is what I have so far:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim I As Range
Set I = Intersect(Range("D7:D252"), Target)
If I Is Nothing Then Exit Sub
Application.EnableEvents = False
Dim c As Range
For Each c In I
c.Offset(0, 1).Value = Environ("Username")
Next c
Application.EnableEvents = True
End Sub
I need to repeat the above but with additional ranges of cells: G7:G252, I7:I252,L7:L252 plus about 10 more columns with the same rows.
I've tried: Set I = Intersect(Range("D7:D252"),Range("G7:G252"), Range("I7:I252"),target)
and a few other guesses, but to no avail.
Help, pretty please!
I have a spreadsheet where various employee's will fill in the date the complete their assignment, then it flows to the next person. I am trying to use VBA to create a "username" stamp for multiple columns.
This is what I have so far:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim I As Range
Set I = Intersect(Range("D7:D252"), Target)
If I Is Nothing Then Exit Sub
Application.EnableEvents = False
Dim c As Range
For Each c In I
c.Offset(0, 1).Value = Environ("Username")
Next c
Application.EnableEvents = True
End Sub
I need to repeat the above but with additional ranges of cells: G7:G252, I7:I252,L7:L252 plus about 10 more columns with the same rows.
I've tried: Set I = Intersect(Range("D7:D252"),Range("G7:G252"), Range("I7:I252"),target)
and a few other guesses, but to no avail.
Help, pretty please!