ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Rearranging numbers (https://www.excelbanter.com/excel-discussion-misc-queries/120828-re-rearranging-numbers.html)

Gary''s Student

Rearranging numbers
 
Here is some demo code, it will run as is:


Sub ashw()
' gsnu
For i = 1 To 100
Cells(i, "A") = "=rand()"
Cells(i, "B") = i
Next

n = Application.InputBox("enter the number of additional columns (<254) ",
Type:=1)

For i = 1 To n
Columns("A:B").Sort Key1:=Range("A1")
For j = 1 To 100
Cells(j, i + 2) = Cells(j, "B")
Next
Next
End Sub

1. put the real data in column B
2. comment out Cells(i, "B") = i
3. change 100 to the number of items
--
Gary's Student


"ashw1984" wrote:

hi there could anybody help
Using visual basic i need to rearrange a column of numbers in a random order
and paste them into the next column. then repeated 'x' amount of time's.
along the spread sheet using an inputbox to ask for 'x'
thanks guys



All times are GMT +1. The time now is 10:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com