3

Writing macro for the first time, I have to copy only cell values to another and which I got it working, however, I am not sure, how to copy entire column without specifying range since range may be different every time. Here, I am trying with a range which is working, but I want it to check values of cell for that column and until it finds a value copy/paste to the another column.

Here is the code I have so far:

Sub CopyingCellValues()

Range("E2:E7").Copy
Range("C2:C7").PasteSpecial xlPasteValues

End Sub

Thanks.

1 Answer 1

3

Simple Columns copy will be...

Sheets("Sheet Name").Columns(1).Copy Destination:=Sheets("Sheet Name").Columns(2)

Helpful info at MSDN on Getting Started with VBA in Excel 2010


Edit:

With out the formula, Try

Sub CopyingCellValues()
    Range("E:E").Value = _
    Range("C:C").Value
End Sub

Sub ValueToValue()
    [E:E].Value = [C:C].Value
End Sub
Sign up to request clarification or add additional context in comments.

2 Comments

I did paste special since the column I am copying from is being derived from a formula, but when I only need to copy and paste value and not formula. Do I need to do Sheet Names even though its in the same sheet?
Thanks for the help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.