Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 354
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
exit cell automatically after entering data Patrick Riley Excel Worksheet Functions 0 March 20th 08 03:23 PM
Exit Field vs Exit Button...... roy_ware Excel Programming 2 October 10th 07 04:05 PM
Do not propmt to save data on exit Glenn Rathke \(Soft Design Consulting\) Excel Worksheet Functions 3 June 25th 06 05:27 PM
Validation data on exit Excel or save Atram Informatika Excel Programming 5 February 6th 06 09:36 PM
If a called sub exit, how to the caller exit right away? luvgreen[_4_] Excel Programming 4 February 24th 04 05:06 PM


All times are GMT +1. The time now is 09:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"