Macro help

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,284
Office Version
  1. 365
Platform
  1. Windows
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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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: 6
Upvote 0
Can you share the list via XL2BB?
 
Upvote 0
Can you share the list via XL2BB?
options are disabled..
1726838486396.png
 
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
Now I've tried from my personal laptop but Im getting attached error msg when i try to add xl2bb add in
 

Attachments

  • ss1.jpg
    ss1.jpg
    174.4 KB · Views: 4
Upvote 0

Forum statistics

Threads
1,223,948
Messages
6,175,569
Members
452,652
Latest member
eduedu

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