Macro help

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,247
Hi All, Long back again.. :)

need help in terms of vba code.

I've created one column with the help of Rank formula. Now I want any 2 records of every rank number on another sheet. Randomly. any code can I get please..
 
Do you just want 2 random for eacn rank from the rows marked "Consider" in col.BP?
If so,
try change
1)
Rich (BB code):
    a = Range("bm2", Range("bm" & Rows.Count).End(xlUp)(1, 2)).Value
to
Rich (BB code):
    a = Range("bm2", Range("bp" & Rows.Count).End(xlUp)(1, 4)).Value
2)
Rich (BB code):
    For i = 1 To UBound(a, 1)
        dic(a(i, 2)) = Trim$(dic(a(i, 2)) & " " & i)
    Next
to
Rich (BB code):
    For i = 1 To UBound(a, 1)
        If LCase$(a(i, 4)) = "consider" Then dic(a(i, 2)) = Trim$(dic(a(i, 2)) & " " & i)
    Next
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Do you just want 2 random for eacn rank from the rows marked "Consider" in col.BP?
If so,
try change
1)
Rich (BB code):
    a = Range("bm2", Range("bm" & Rows.Count).End(xlUp)(1, 2)).Value
to
Rich (BB code):
    a = Range("bm2", Range("bp" & Rows.Count).End(xlUp)(1, 4)).Value
2)
Rich (BB code):
    For i = 1 To UBound(a, 1)
        dic(a(i, 2)) = Trim$(dic(a(i, 2)) & " " & i)
    Next
to
Rich (BB code):
    For i = 1 To UBound(a, 1)
        If LCase$(a(i, 4)) = "consider" Then dic(a(i, 2)) = Trim$(dic(a(i, 2)) & " " & i)
    Next
Hi Fuji, I appreciate once again for your valuable time and effort for sharing solution with me. But not getting as per my expectation. I've attached one more screenshot, it will help you to understand what my expectation output is.
 

Attachments

  • output be like.jpg
    output be like.jpg
    213.2 KB · Views: 2
Upvote 0
Can you share the list via XL2BB?
 
Upvote 0
Does this help?
 
Upvote 0
Thank You Experts for your valuable time and sharing me options to get XL2BB but it is get blocked by IT and hence disable macro dosent work. I've to post this from my personal laptop. Let me try that :(
 
Upvote 0
OK,
I will be off line soon, so my next response will be sometime tomorrow. (it's close to midnight here)
Please, the sheet should contain row data(should be dummy) and the result that you want, so that I can see what you are really trying to achieve.
 
Upvote 0

Forum statistics

Threads
1,221,544
Messages
6,160,427
Members
451,645
Latest member
androidmj

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