1

How do I increment the column reference in the code below? Just the column ref, the row values can stay the same.

Range("w3:w54").PasteSpecial

I'm hoping I can do something like this:

For i = 23 to 27
'start at column w (which is number 23)

Range(Columns(i)+"3":Columns(i)+"54").PasteSpecial  

Next            

But that throws an error.

Any suggestions?

1 Answer 1

3

You can use the Cells(Row, Column), so you increment the Column part easily with the numeric value, without using a conversion function from Numeric to Alphabetical.

For i = 23 To 27
    'start at column w (which is number 23)
    Range(Cells(3, i), Cells(24, i)).PasteSpecial
Next
Sign up to request clarification or add additional context in comments.

2 Comments

Exactly what I wanted! Thanks a lot for your time.
Also ...Range("3:24").Columns(i)... is possible while paste will extend the range as it needs to. In most cases also ...Cells(3, i).Paste will do the job ;)

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.