worksheet_change returning formulas not values

ZEEK2010

New Member
Joined
Dec 5, 2015
Messages
3
I need values not formulas from source.

Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    Dim rmonitor As Range
    Dim rTarget As Range

    Set rmonitor = Range("B1:o1554")
    Set rTarget = ThisWorkbook.Sheets("DATA BASE").Range("x1:ak1554")

    If Not Intersect(Target, rmonitor) Is Nothing Then
        rmonitor.Copy rTarget
    End If

    Set rmonitor = Nothing
    Set rTarget = Nothing
End Sub
 
Last edited by a moderator:

Some videos you may like

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
Welcome to the Board!

Just a small tweak:

Code:
    If Not Intersect(Target, rmonitor) Is Nothing Then
        rTarget.Value = rmonitor.Value
    End If
HTH,
 

vcoolio

Well-known Member
Joined
Jun 29, 2014
Messages
988
Hello Smitty,

Just a question which I'm sure Zeek would be interested to know the answer to:-

With these two lines of code,

Code:
Set rmonitor = Nothing   
Set rTarget = Nothing
are they really necessary? I've had conflicting replies as to their value as some say that on closing the work book, the clip board (memory) is cleared anyway.
Others say that it doesn't hurt to make sure.

What's your opinion?

Cheerio,
vcoolio.
 

Watch MrExcel Video

Forum statistics

Threads
1,102,291
Messages
5,485,973
Members
407,523
Latest member
Talicius

This Week's Hot Topics

Top