Thread
:
exit sub if no data
View Single Post
#
1
Posted to microsoft.public.excel.programming
Daniel
external usenet poster
Posts: 354
exit sub if no data
Thanks all
It works like a charm
Daniel
"Don Guillett" wrote:
You may have had the dreaded space bar in cell a2 so try
Sub exitif()
With ActiveSheet
'If Cells(2, "a").Value = "" Then Exit Sub
If Len(Application.Trim(Cells(2, "a"))) < 1 Then Exit Sub
MsgBox "hi"
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Daniel" wrote in message
...
Thanks Bob
I code this at the begin of sub and cause error??
with activesheet
If Cells(2, "a").Value = "" Then
Exit Sub
end if
"Bob Phillips" wrote:
A row of a column? Do you mean a cell?
If Cells(the_row_num, "the_Column_letter").Value = "" Then Exit Sub
--
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my
addy)
"Daniel" wrote in message
...
hi
How can I code so that my VBA will exit sub if no data in a row of a
column?
Thanks
Daniel
Reply With Quote
Daniel
View Public Profile
Find all posts by Daniel