Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88868

How to write IsEmpty on a selection in VBA

$
0
0

I am trying to write an IsEmpty code to check if there are any empty cells in a certain selection range. The thing is it cannot be hard-coded such as B100:J because I am importing data constantly so the data range will constantly change and never be the same. So, before I make the excel a PDF via Macro, I want to check all the cells to see if there is an empty cell, therefore I can delete it or make adjustments to it. The code below is what I have so far, but it doesn't run and I am kind of stuck, anything helps! The reason I have B15:J15 is it because that's where the data will start and end, but I will never know how long it will go down, it can go from B100:J100 or B30:J30. Thanks, everyone.

Sub IsEmpty()
'check to see if there are any blank cells before archiving

Dim N As Range
Set N = Range("B15:J15").End(xlDown)

If IsEmpty(Range(N).Value) = False Then
MsgBox ("Blank information, please double check")

End If

End Sub

Viewing all articles
Browse latest Browse all 88868


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