PDA

View Full Version : Paste as Value



Marcke
12-11-2008, 06:43 AM
Hi,

I'd like to move some columns and use paste as value. Can I do this with vba?

Thanks in advance,

Wannes

'Paste as value should be used
shCalculations.Select
Range("getFirstCalculationColumn:getFirstCalculationColumn+getNumberOfDaysArchived-1").Copy
Range("getFirstCalculationColumn+1:getFirstCalculationColumn+getNumberOfDaysArchiv ed").Paste

Bob Phillips
12-11-2008, 06:55 AM
shCalculations.Select
Columns(getFirstCalculationColumn).Resize(, getNumberOfDaysArchived).Copy
Columns(getFirstCalculationColumn + 1).Resize(, getNumberOfDaysArchived).PasteSpecial Paste:=xlPasteValues

Marcke
12-15-2008, 08:24 AM
Hi xld,

Thanks for the help.

It does not work perfect yet though (it copies one column too much), and would like to learn as well. Could you explain what the resize function does?

Bob Phillips
12-15-2008, 09:29 AM
Resize does exactly what it says, it resizes the range being processedby the number of rows and/or columns identified.

Columns(getFirstCalculationColumn) is one column, so Resize makes more affected columns.