VBA Macro to Match Cells in Range

DallyDally

New Member
Joined
May 14, 2021
Messages
4
Office Version
  1. 2010
Platform
  1. Windows
Hello,

Looking for a macro to match already entered cells. I would be matching the persons picks ($1 fields) with the earnings field. After the match, I would sort highest to lowest.

sheet is attached and a picture for quick reference.

Any help would be appreciated and thanks in advance!

picks example match.PNG
picks example match FINAL.PNG
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Macro to Match Cells
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Macro to Match Cells
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
Hey Sorry about that. I will edit post now. I have posted same question in another forum. Thank you
 
Upvote 0
How about
VBA Code:
Sub Dally()
   With Range("F3:J12")
      .Value = Evaluate("if(" & .Address & "="""",""""," & .Address & "*e3:e12)")
   End With
End Sub
If you want to sort by total row, then you will need to get rid of the merged cells.
 
Upvote 0
How about
VBA Code:
Sub Dally()
   With Range("F3:J12")
      .Value = Evaluate("if(" & .Address & "="""",""""," & .Address & "*e3:e12)")
   End With
End Sub
If you want to sort by total row, then you will need to get rid of the merged cells.
Thank you very much that worked perfectly! I will unmerge the cells at the top and try to figure out a way to auto sort in the code. Thank you again I appreciate it!
 
Upvote 0
Once the cells are unmerged you can use
VBA Code:
Sub Dally()
   With Range("F3:J12")
      .Value = Evaluate("if(" & .Address & "="""",""""," & .Address & "*e3:e12)")
   End With
   Range("F1:J15").Sort Rows(15), xlDescending, , , , , , , , , xlSortRows
End Sub
which will sort by row 15.
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,390
Members
448,957
Latest member
Hat4Life

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