View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vergel Adriano Vergel Adriano is offline
external usenet poster
 
Posts: 857
Default macro to copy columns

bernd,

assuming the target sheet is Sheet2, maybe something like this:

Sub test()

Dim iColumns As Integer

iColumns = InputBox("Enter how many columns to copy")
Range(Cells(1, 11), Cells(1, 10 + iColumns)).EntireColumn.Copy
Sheet2.Range("K1").PasteSpecial xlPasteValues

End Sub


--
Hope that helps.

Vergel Adriano


"bernd" wrote:

Hello,

I need a macro that copies columns to a specific sheet. The steps that
have to be taken:
1. the macro is called
2. a form asks the user for a number. This number is the amount of
columns counting from left to right that have to be copied, starting
with colomn K. (So, if the number is 3, column K, L and M have to be
copied)
3. The copied columns have to be pasted on another worksheet. Also
starting from column K.
Notice: the cells that will be copied contain formulas, so paste
special+values should be used.

Can someone realize such a macro?

Many thanks!