VBA Code - Add Shuffle Capability on it

lanc3lot

New Member
Joined
Aug 9, 2017
Messages
1
Hello everyone,

I have this code
Code:
[COLOR=#000000][FONT=&quot]Sub CopyData()[/FONT][/COLOR]
[COLOR=#000000][FONT=&quot]Dim Rng As Range[/FONT][/COLOR]
[COLOR=#000000][FONT=&quot]Dim InputRng As Range, OutRng As Range[/FONT][/COLOR]
[COLOR=#000000][FONT=&quot]xTitleId = "Lottery"[/FONT][/COLOR]
[COLOR=#000000][FONT=&quot]Set InputRng = Application.Selection[/FONT][/COLOR]
[COLOR=#000000][FONT=&quot]Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)[/FONT][/COLOR]
[COLOR=#000000][FONT=&quot]Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8)[/FONT][/COLOR]
[COLOR=#000000][FONT=&quot]Set OutRng = OutRng.Range("A1")[/FONT][/COLOR]
[COLOR=#000000][FONT=&quot]For Each Rng In InputRng.Rows[/FONT][/COLOR]
[COLOR=#000000][FONT=&quot]    xValue = Rng.Range("A1").Value[/FONT][/COLOR]
[COLOR=#000000][FONT=&quot]    xNum = Rng.Range("B1").Value[/FONT][/COLOR]
[COLOR=#000000][FONT=&quot]    OutRng.Resize(xNum, 1).Value = xValue[/FONT][/COLOR]
[COLOR=#000000][FONT=&quot]    Set OutRng = OutRng.Offset(xNum, 0)[/FONT][/COLOR]
[COLOR=#000000][FONT=&quot]Next[/FONT][/COLOR]
[COLOR=#000000][FONT=&quot]End Sub[/FONT][/COLOR]

Is there a way, i can add on the code, shuffle capabilities? So when i run it, the end result will be shuffled it's values? Ty in advance
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top