View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default can I use an update macro on multiple columns

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("F:F,J:J,M:M")) Is Nothing Then Exit Sub
Application.EnableEvents = False
Target.Offset(0, 1).Value = Date
Target.Offset(0, 2).Value = Environ("UserName")
Application.EnableEvents = True
If Intersect(Target, Range("F:F,J:J,M:M")) = "Complete" Then
Target.Offset(0, 3).Value = "---"
Target.Offset(0, 4).Select
Else: End If
End Sub

--
Regards,
Tom Ogilvy

"Shahid" wrote:

Hello,

Am using the following code to run a macro after I update a cell within a
column..It works fine on one column (F:F)..but I wanted it to do the same
thing on multiple columns J:J, M:M, etc....

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("F:F")) Is Nothing Then Exit Sub
Application.EnableEvents = False
Target.Offset(0, 1).Value = Date
Target.Offset(0, 2).Value = Environ("UserName")
Application.EnableEvents = True
If Intersect(Target, Range("F:F")) = "Complete" Then
Target.Offset(0, 3).Value = "---"
Target.Offset(0, 4).Select
Else: End If
End Sub

Any help??