Add to existing Macro

Utradeshow

Well-known Member
Joined
Apr 26, 2004
Messages
769
Hi Guy's I have a macro that performes this..

When Column "C" is changed it enters date in column "Y"
I would like to have it also when Column "B" is changed to put the date in Column "Z" I belive it would be a "Rng 2" thing but i can't get it.

Here is the code.
[/code]Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Calculate
Dim rng As Range
' Only look at single cell changes
If Target.Count > 1 Then Exit Sub
' Set Target Range
Set rng = Range("C1:C1000")
' Only look at that range
If Intersect(Target, rng) Is Nothing Then Exit Sub
Target.Offset(, 22) = Date
If IsDate(Target) Then _
Target.Offset(, 1) = Format(Target, "mmm")

End Sub
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
This will do it:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Calculate
Dim rng As Range
' Only look at single cell changes
If Target.Count > 1 Then Exit Sub
' Set Target Range
Set rng = Range("C1:C1000")
Set Rng2 = Range("B1:B1000")
' Only look at that range
If Intersect(Target, rng) Is Nothing Then GoTo CheckB
Target.Offset(, 22) = Date
If IsDate(Target) Then _
Target.Offset(, 1) = Format(Target, "mmm")
Exit Sub

CheckB:
If Intersect(Target, Rng2) Is Nothing Then Exit Sub
Target.Offset(, 24) = Date
If IsDate(Target) Then _
Target.Offset(, 1) = Format(Target, "mmm")
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,011
Messages
6,122,680
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top