Excel Challenge

5,625 pts.
Tags:
Microsoft Excel
Let's say that I have an Excel spreadsheet that contains a long list in column A. How might I go about taking every 40 items in column A and moving it to its own column? For example, A1:A40 remains in column A; A41:80 gets moved to column B and so on. I'm not looking for a thought process but rather code samples, if available.
ASKED: September 10, 2008  12:37 AM
UPDATED: September 10, 2008  2:57 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

This Excel Macro should do the trick for you.

<pre> Dim i As Integer
Dim j As Integer
i = 2
j = 41
Do Until Range(“A” & j).Value = “”
Range(“A” & j & “:A” & j + 39).Select
Selection.Cut
Range(Chr(i + 64) & “1″).Select
ActiveSheet.Paste
j = j + 40
i = i + 1
Loop</pre>

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following