Paul Sansom
Board Regular
- Joined
- Jan 28, 2013
- Messages
- 178
- Office Version
- 2021
- 2016
- Platform
- Windows
Hi
I have quite a few repetitions of the scrip below with similar changing values.
IS there a neater (For each) loop that i could simplify this code rather than just repeating it?
All/Any suggestions gratefully received..... Paul
I have quite a few repetitions of the scrip below with similar changing values.
IS there a neater (For each) loop that i could simplify this code rather than just repeating it?
Code:
Private Sub Worksheet_Activate()
MyRng = 4 + Sheet12.Cells(3, 5)
MyRng = "E5:" & "E" & MyRng
Sheet12.Range(MyRng).Copy
Sheet5.Range("I4").PasteSpecial xlPasteValues, , , True
MyRng = 4 + Sheet12.Cells(3, 7)
MyRng = "G5:" & "G" & MyRng
Sheet12.Range(MyRng).Copy
Sheet5.Range("M4").PasteSpecial xlPasteValues, , , True
End Sub
All/Any suggestions gratefully received..... Paul