I have a auto macro by target but it only copies values how could this be adjust
ID: 3563793 • Letter: I
Question
I have a auto macro by target but it only copies values how could this be adjusted so it copies formats. I also tried replacing the bold part but still nothing works.
The macro is provided here
Dim Rng As Range, Rng2 As Range
Dim rCell As Range
Set Rng = Me.Range("B3:B5")
Set Rng2 = Intersect(Rng, Target)
If Not Rng2 Is Nothing Then
For Each rCell In Rng2.Cells
On Error GoTo XIT
Application.EnableEvents = False
With rCell
Set srcRng = .Offset(0, 1)
Set destRng = .Offset(0, 2)
destRng.Paste.Value = srcRng.Value
End With
Next rCell
End If
XIT:
Application.EnableEvents = True
End Sub
Thanks!!
Explanation / Answer
Change this line:
destRng.Paste.Value = srcRng.Value
to
srcRng.copy destRng
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.