Quantcast
Channel: Microsoft Community - Super Fresh
Viewing all articles
Browse latest Browse all 1237235

Excel VBA lastrow = Range("A15", Range("A15").End(xlUp)).Row

$
0
0

1/25/2015

Hello I am trying to write a vba code to find the last row of a range, it may or may not have data already in the range.

These 2 formulas, worked for me for about 2 weeks and then all of a sudden stopped working?

Dim Lastrow as Long

Lastrow = Range("A5", Range("A15").End(xlUp)).row

and

lastrow = Range("A15", Range("A15").End(xlUp)).Row

msgbox lastrow

Both used to work, but not anymore, I get this error message: Run-time Error '13': Type mismatch

The formula should return the number 5 if the range is empty, or the last row number with something in the row.

Any help would be appreciated.

Thanks


Viewing all articles
Browse latest Browse all 1237235

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>