PDA

View Full Version : How to Skip a column for every 2 columns while Paste the values?



yug
10-07-2014, 11:26 AM
I need to paste the values into a range of cells but i want to skip a column as shown in the below format.

Public Sub Test()
Dim range1 As Range
Range("A1:B1:C1:D1").Value = 5
Set range1 = ActiveWorkbook.Names("DestinationLocation").RefersToRange
Range("A1:B1:C1").Copy
range1.PasteSpecial xlPasteValues
End Sub

I want the output like as shown in the below format.



5
5
5
5


























5

5

5

5

SamT
10-07-2014, 12:35 PM
Can't use Paste that way and you will need to find to start of the RefersToRange Range. From the info you've given so far, that is all I can say right now. I just can't tell exactly what you are trying to accomplish.

Dim RefersToFirst As Range
Dim RefersToLast As Range

With ActiveWorkbook.Names("DestinationLocation")
Set RefersToFirst = .RefersToRange.Cells(1)
Set RefersToLast = .RefersToRange.Cells(.RefersToRange.Cells.Count)
End With