VBA to Sort and insert blank row based on criteria

unknownymous

Board Regular
Joined
Sep 19, 2017
Messages
249
Office Version
  1. 2016
Platform
  1. Windows
Hi Guys,

Can you possibly help me out on the codes that I need to use? Newbie here..
I'm aiming to work on the following:
1. Sort by descending order and separate the Zero scores.
2. Next, sort it by Confirmation and separate the N (Confirmation) and add headers as well like those with "Y".

PS: The columns might be interchangeable so might be needing to be specific on the header name (Score, Confirmation etc.)


Before code execution.....

NameSportsScoreConfirmation
TaylorVolleyball10Y
BenBasketball20Y
StephenBaseball0Y
CaraVolleyball6N
EmmaTennis4N

<tbody>
</tbody>

After code execution:

NameSportsScoreConfirmation
BenBaskell20Y
TaylorVolleyball10Y
UNCONFIRMED
NameSportsScoreConfirmation
CaraVolleyball6N
EmmaTennis4N
ZERO SCORE
StephenBaseball0Y

<tbody>
</tbody>



Any help will be much appreciated...:)
 
Glad to help & thanks for the feedback
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi Fluff, one last favor...What if I want to add row color (black) & font (white) to the header names - UNCONFIRMED, NOT INCLUDED & NO SCORE for easy reference. Thank again for the help.
 
Upvote 0
Try adding this
Code:
   If FoundRow > 0 Then
      Rows(FoundRow).Resize(3).Insert
      Cells(FoundRow + 1, 1).Value = BreakData(i + 1)
      Range("A1:C1").Copy Range("A" & FoundRow + 2)
      [COLOR=#ff0000]With Range("A" & FoundRow + 2).Resize(, 3)
         .Interior.Color = vbBlack
         .Font.Color = vbWhite
      End With[/COLOR]
   End If
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,790
Members
451,589
Latest member
Harold14

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