VBA Find Next Non-Blank Row

FalconFlyer

New Member
Joined
May 18, 2015
Messages
30
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD][/TD]
[TD]ABC
[/TD]
[TD]4
[/TD]
[TD]15
[/TD]
[TD]600
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD][/TD]
[TD][/TD]
[TD]89
[/TD]
[TD]100
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD][/TD]
[TD][/TD]
[TD]5
[/TD]
[TD]150
[/TD]
[TD]8
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD][/TD]
[TD]DEF
[/TD]
[TD]10
[/TD]
[TD]5
[/TD]
[TD]20
[/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD][/TD]
[TD][/TD]
[TD]15
[/TD]
[TD]10
[/TD]
[TD]22
[/TD]
[/TR]
[TR]
[TD]6
[/TD]
[TD][/TD]
[TD][/TD]
[TD]200
[/TD]
[TD]15
[/TD]
[TD]15
[/TD]
[/TR]
[TR]
[TD]7
[/TD]
[TD][/TD]
[TD]GHI
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I want to find a range of rows in Column B from the first non-blank to the last blank (B1:B3 and then B4:B6). With that range, I would like to sort by another column (for example, Column E), sort (B1:B3) by Column M then sort the next set. I am not sure where to start. I have tried looking into Find.. FindNext. If someone can point me in the right direction, I would be thankful. TIA
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
If you fill in the blanks in column B (which is easy to do via SpecialCells/Blanks) then you could sort by col B /col E / col M.
 
Last edited:
Upvote 0
If you fill in the blanks in column B (which is easy to do via SpecialCells/Blanks) then you could sort by col B /col E / col M.

That may be the route I have to go.

But I am not sure I am closer to figuring it out. I still have to sort in sets, i.e Row 2-5, Row 6-20, etc.

I appreciate your reply.
 
Upvote 0
  • To fill in the blanks in column B :
  • Select column B
  • On the Ribbon's Home tab, click Find & Select.
  • Click Go To Special.
  • In the Go To Special dialog box, click Blanks, then click OK.
  • Assuming B2 is the active cell, type =B1
  • Press Crtl+Enter
  • Select column B and copy/pastespecial/values
  • Then sort normally in the way you want (col B/col E/col M)
 
Upvote 0

Forum statistics

Threads
1,224,837
Messages
6,181,255
Members
453,028
Latest member
letswriteafairytale

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