hi
im having problems I would like to select say 2 id from sheet1 and 2 names from sheet 2 randomly and copy to sheet3 ,to cells a and b,have seen various codes but none seem to fit the bill,any suggestions please
cheers colin
hi
im having problems I would like to select say 2 id from sheet1 and 2 names from sheet 2 randomly and copy to sheet3 ,to cells a and b,have seen various codes but none seem to fit the bill,any suggestions please
cheers colin
Last edited by cfinch100; 05-10-2014 at 05:44 PM.
Hi C,
Try this:
![]()
Sub CFinch(): Dim w1 As Worksheet, w2 As Worksheet, w3 As Worksheet, N, ID, X As Integer Set w1 = Sheets("Sheet1"): Set w2 = Sheets("Sheet2"): Set w3 = Sheets("Sheet3") ID = w1.Range("B2").CurrentRegion: N = w2.Range("A2").CurrentRegion Do: X = Int(Rnd() * UBound(N)): Loop Until X <> 0: w3.Range("A1") = w2.Range("A" & X + 1) Do: X = Int(Rnd() * UBound(ID)): Loop Until X <> 0: w3.Range("B1") = w1.Range("B" & X + 1) End Sub
If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)
You can't do one thing. XLAdept
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin
hi
that worked a treat thanks,ill try and mod for all other sheets I need ,many thanks
colin
You're welcome and thanks for the rep!![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks