Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
can I use an update macro on multiple columns
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?? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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?? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
can I use an update macro on multiple columns
Works excellently...thanks
"Tom Ogilvy" wrote: 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?? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I update macro to delete zero amount columns? | Excel Discussion (Misc queries) | |||
Update Cell in Multiple Sheets - Macro | Excel Worksheet Functions | |||
Macro to add Multiple columns | Excel Discussion (Misc queries) | |||
how do I get a macro to update dates in multiple worksheets? | Excel Programming | |||
Sum Multiple Columns with Macro | Excel Programming |