-3

How can I select the data after the blank row occurrence?

I don't know the code, I just want to show in the image what I want to achieve.

The situation is opposite to the following query:

Select Cells in Range until row is blank

enter image description here

Geographos
  • 827
  • 2
  • 23
  • 57

1 Answers1

2

This will only select the cells found BETWEEN the first instance of blanks and the last instance. If you need to change that the modify the line Set Target_End


Sub Try()

Dim ws As Worksheet: Set ws = ThisWorkbook.Sheets("Sheet1")
Dim Target_Start As Range, Target_End As Range

Set Target_Start = ws.Cells.Find("", SearchOrder:=xlByColumns).Offset(1)
Set Target_End = Target_Start.End(xlDown).End(xlToRight)

ws.Range(Target_Start, Target_End).Select

End Sub

enter image description here

urdearboy
  • 14,439
  • 5
  • 28
  • 58
  • 2
    you need to be careful with `Set Target_End = Target_Start.End(xlDown).End(xlToRight)` if there is only one line it will go to the bottom of the page – Scott Craner Mar 16 '21 at 16:57
  • 1
    @ScottCraner good point - I did not consider that. Assumed there will always be at least `Data, Blank, Data` which would avoid that issue. Not going to update since I prob shouldn't have put a solution here anyway given lack of info/code. – urdearboy Mar 16 '21 at 17:00
  • It works great! Thanks! How can I modify in order to refer my situation to the last set of data after the 2nd blank row? – Geographos Mar 16 '21 at 17:04
  • That is not the question you asked here. This does exactly what you stated you needed. Take some time and try to implement this to your other post and come back after you have had enough time to at least say you put some honest effort into solutioning this. If you can't post a question and share the code you have tried thus far – urdearboy Mar 16 '21 at 17:05