Application Intersect - referring to a named range

EEEEEE

New Member
Joined
Jul 29, 2016
Messages
18
Hi,
Basically if a cell is changed within a range (q_one) I want to put a date in another range(q_one_date) in the same row that the target cell was changed.

The code I got referred to a set cell range rather than a named range. I have successfully changed it to work if any cell is changed in (q_one) but I cannot figure out how to change the code to then place the date on the same row as the target cell but within another named range (q_one_date), the code below refers to a set column....


Private Sub Worksheet_Change(ByVal target As Range)

If Not Application.Intersect(Range("q_one"), target) Is Nothing Then


Range("AA" & target.Row).Value = Date


MsgBox ("Sheet has been changed, last updated date automatically changed. Please ensure you update the comments section with changes.")

End if
End sub


Hoping someone can help

Thanks :)
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
If "q_one_date" refers to a range that starts at row 1, then:

Code:
Range("q_one_date").Cells(1).Offset(Target.Row - 1).Value = Date

OR
This one doesn't required "q_one_date" refers to a range that starts at row 1:

Code:
Cells(Target.Row, Range("q_one_date").Column).Value = Date
 
Last edited:
Upvote 0
If "q_one_date" refers to a range that starts at row 1, then:

Code:
Range("q_one_date").Cells(1).Offset(Target.Row - 1).Value = Date

OR
This one doesn't required "q_one_date" refers to a range that starts at row 1:

Code:
Cells(Target.Row, Range("q_one_date").Column).Value = Date



Second options works perfectly!!! Thanks so much, really appreciate it. :)
 
Upvote 0
You're welcome, glad to help, & thanks for the feedback.:)
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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