Select dynamic cell range based on blank value not formula in VBA

eastrand

Board Regular
Joined
Nov 27, 2013
Messages
101
Office Version
  1. 365
Platform
  1. Windows
I have a worksheet that has formulas from A7:D100. These formulas return values to a certain point(dynamic) and then returns "" the rest of the way down. I'm looking for a way in VBA to detect where the first row is with "" and then selecting A7:D??(whatever the first "" row). This selection will then be stored into a variable to be used elsewhere. So far, everything I find that searches for blank cells goes all the way to row 101 because there are formulas to row 100. I need something that will look for "" or blank cell values and not formulas. Any help on this is much appreciated.

ABCD
6DateCustomerQuantityTotal
71/1/2019Cust112$23.32
81/3/2010Cust224$52.23
91/6/2019Cust310$20.53
10""""""""
11""""""""
12""""""""
13""""""""

<tbody>
</tbody>
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Maybe....

Code:
Range(Range("A7"), Columns("D").Find("*", , xlValues, , xlByRows, xlPrevious).Offset(1)).Select

although it would be more normal to be selecting to the row above the first row with "".
 
Last edited:
Upvote 0
Actually I was a bit OTT with the use of Range so...

Code:
Range("A7", Columns("D").Find("*", , xlValues, , xlByRows, xlPrevious).Offset(1)).Select
 
Last edited:
Upvote 0
Solution
Wow! I've been searching on and off for this for over a year. I had something close but I was missing the *. Thank you, it worked perfectly.
 
Upvote 0
BTW, the reason I need the first row with the "" included is because a couple of the columns have a total at the end.
 
Upvote 0

Forum statistics

Threads
1,203,186
Messages
6,053,984
Members
444,696
Latest member
VASUCH

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