View Full Version : [SOLVED:] Pasting columns to the next blank columns
tatendamark
09-25-2018, 07:52 AM
Please help with a VBA code that copies and pastes contents in Range C8 : D19, to the next blank column (Range E8 : F19). With each run, I would like to paste the results from Range C8 : D19 to the next blank columns.
I would also like to be able to clear the contents in Range E8 : N19, at any point.
Paul_Hossler
09-25-2018, 06:28 PM
This?
Option Explicit
Sub CopyNextColumn()
Dim r1 As Range, r2 As Range
Set r1 = ActiveSheet.Range("C8:D19")
Set r2 = ActiveSheet.Cells(8, ActiveSheet.Columns.Count).End(xlToLeft).Offset(0, 1)
r1.Copy r2
End Sub
Sub ClearData()
ActiveSheet.Range("E8:N19").ClearContents
End Sub
tatendamark
09-26-2018, 12:20 AM
Awesome. Thanx a mill, Paul.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.