Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

rina asked in Computers & InternetSoftware · 3 years ago

If i have a list of 1000 numbers on excel. I want to get them into columns of 40 per column. How do i do it?

2 Answers

Relevance
  • 3 years ago

    You don't state which column contains your list of 1000 numbers, so this example assumes the list is in Column A. If your list column is not "A" then advise your column letter and I will adjust the code.

    Otherwise, copy the event handler code to the clipboard (highlight the entire code, right click inside the area, and 'Copy')

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _

    Cancel As Boolean)

    Dim i, j, LastRow

    j = 2

    LastRow = Range("A" & Rows.Count).End(xlUp).Row

    If LastRow = 40 Then

    Target.Offset(1).Select

    Exit Sub

    End If

    For i = 40 To LastRow Step 40

    Range("A" & i + 1 & ":" & "A" & i + 40).Copy Destination:=Cells(1, j)

    j = j + 1

    Next

    Range("A41:A" & LastRow).Delete

    Target.Offset(1).Select

    End Sub

    Select worksheet containing your list and right click the sheet tab at the bottom.

    Select 'View Code'.

    Paste the event handler into the white editing area to the right (right click inside the area and 'Paste').

    Close the VBE (red button - top right).

    To 'transpose' the numbers into 25 columns, simply double click any cell in the worksheet.

    This entire process would take about 2 minutes, if followed correctly, as opposed to how ever long it would take to cut and paste 25 groups of 40 rows.

  • Anonymous
    3 years ago

    You highlight the list of 1,000 numbers and hit <cntrl> C. You then highlight the 1,000 cells you want them pasted into and hit <cntrl> V.

Still have questions? Get your answers by asking now.