PC Review


Reply
Thread Tools Rate Thread

can I use an update macro on multiple columns

 
 
=?Utf-8?B?U2hhaGlk?=
Guest
Posts: n/a
 
      11th Oct 2007
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 With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      11th Oct 2007
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 With Quote
 
=?Utf-8?B?U2hhaGlk?=
Guest
Posts: n/a
 
      11th Oct 2007
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Want a macro for multiple columns on current macro for column Valerie Microsoft Excel Programming 4 23rd Feb 2009 07:30 PM
Macro to add Multiple columns jlclyde Microsoft Excel Misc 5 3rd Feb 2009 05:27 PM
I need a macro to transpose multiple columns A1-Z1, A2-X2 etc =?Utf-8?B?V29tYmF0NjI=?= Microsoft Excel Misc 7 18th Sep 2006 05:05 AM
Sum Multiple Columns with Macro Ken Microsoft Excel Programming 2 4th Feb 2004 12:40 AM
macro that loops to multiple columns Brad Zenner Microsoft Excel Programming 1 22nd Jul 2003 03:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:50 PM.