I am working with Excel VBA Copy Paste. Cell R7 has formula =Max ("C77:AD81").
- R7 = Highest Value for Month
- F7 = Highest Value to date
- Q7 = the date F7 was achieved
What I am trying to achieve is if R7 > F7, copy R7 Value to F7 and change the Q7 to = today.
All I'm achieving is R7 changes to max of ("C77:AD81") and the remaining code doesn't work. My code below.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range, r As Range, rv As Long
If Not Intersect(Target, Range("R7")) Is Nothing Then
Set rng = Intersect(Target, Range("R7"))
For Each r In rng
'Change Best Peak Flow and Date Achieved
Select Case r.Value
Case Is > ("F7")
Case Range("R7").Select
Case Range("R7").Copy
Case Range("F7").Select
Case Range("F7").Paste
Case ("R7") = ("F7")
Case Range("Q5").Select
Range("Q5") = Today()
Application.CutCopyMode = False
End Select
Next r
End If
End Sub
Select Case. I will take a look at your code in a moment.