macro to copy columns
Sub ABC()
Dim ans as String
ans = InputBox("How many columns")
if not isnumeric(ans) then exit sub
With worksheets("Sheet1")
.Range("K:K").Resize(rows.count, clng(ans)).copy
End with
Worksheets("Sheet2")
.Range("K:K").PasteSpecial xlValues
End With
End sub
--
Regards,
Tom Ogilvy
"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!
|