Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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??

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I update macro to delete zero amount columns? Nora_GG[_2_] Excel Discussion (Misc queries) 2 June 4th 10 12:35 AM
Update Cell in Multiple Sheets - Macro enna49 Excel Worksheet Functions 2 March 5th 10 04:05 AM
Macro to add Multiple columns jlclyde Excel Discussion (Misc queries) 5 February 3rd 09 05:27 PM
how do I get a macro to update dates in multiple worksheets? BB_XLNovice[_2_] Excel Programming 0 April 27th 07 06:18 PM
Sum Multiple Columns with Macro Ken[_18_] Excel Programming 2 February 4th 04 12:40 AM


All times are GMT +1. The time now is 07:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"