Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 114
Default Exit Sub if count less than zero.

Need help on this.

I don't want the Macro to work if [***IF COUNT(T4:T53) = 0 THEN EXIT SUB***]
inside the Macro below.


Sub SettleAutoDue()

***IF COUNT(T4:T53) = 0 THEN EXIT SUB***

Worksheets("A-3").Range("U4:Z4").Copy
Range("G5").PasteSpecial Paste:=xlPasteValues, Transpose:=True
Application.CutCopyMode = False
Range("G4").Activate

End Sub


Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Exit Sub if count less than zero.

try,

If WorksheetFunction.Count(Range("T4:T53")) = 0 Then Exit Sub

mike

" wrote:

Need help on this.

I don't want the Macro to work if [***IF COUNT(T4:T53) = 0 THEN EXIT SUB***]
inside the Macro below.


Sub SettleAutoDue()

***IF COUNT(T4:T53) = 0 THEN EXIT SUB***

Worksheets("A-3").Range("U4:Z4").Copy
Range("G5").PasteSpecial Paste:=xlPasteValues, Transpose:=True
Application.CutCopyMode = False
Range("G4").Activate

End Sub


Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Exit Sub if count less than zero.

Mark the code using a apostrophe in front; like

'***IF COUNT(T4:T53) = 0 THEN EXIT SUB***


If this post helps click Yes
---------------
Jacob Skaria


" wrote:

Need help on this.

I don't want the Macro to work if [***IF COUNT(T4:T53) = 0 THEN EXIT SUB***]
inside the Macro below.


Sub SettleAutoDue()

***IF COUNT(T4:T53) = 0 THEN EXIT SUB***

Worksheets("A-3").Range("U4:Z4").Copy
Range("G5").PasteSpecial Paste:=xlPasteValues, Transpose:=True
Application.CutCopyMode = False
Range("G4").Activate

End Sub


Thank you.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Exit Sub if count less than zero.

Oops; please ignore the previous post....

COUNT() is a worksheet function.So ..

Sub SettleAutoDue()

If WorksheetFunction.Count(Range("T4:T53")) < 0 Then
Worksheets("A-3").Range("U4:Z4").Copy
Range("G5").PasteSpecial Paste:=xlPasteValues, Transpose:=True
Application.CutCopyMode = False
Range("G4").Activate
End If

End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


" wrote:

Need help on this.

I don't want the Macro to work if [***IF COUNT(T4:T53) = 0 THEN EXIT SUB***]
inside the Macro below.


Sub SettleAutoDue()

***IF COUNT(T4:T53) = 0 THEN EXIT SUB***

Worksheets("A-3").Range("U4:Z4").Copy
Range("G5").PasteSpecial Paste:=xlPasteValues, Transpose:=True
Application.CutCopyMode = False
Range("G4").Activate

End Sub


Thank you.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 150
Default Exit Sub if count less than zero.

It works. Thanks Mike.

"Mike H" wrote:

try,

If WorksheetFunction.Count(Range("T4:T53")) = 0 Then Exit Sub

mike

" wrote:

Need help on this.

I don't want the Macro to work if [***IF COUNT(T4:T53) = 0 THEN EXIT SUB***]
inside the Macro below.


Sub SettleAutoDue()

***IF COUNT(T4:T53) = 0 THEN EXIT SUB***

Worksheets("A-3").Range("U4:Z4").Copy
Range("G5").PasteSpecial Paste:=xlPasteValues, Transpose:=True
Application.CutCopyMode = False
Range("G4").Activate

End Sub


Thank you.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 150
Default Exit Sub if count less than zero.

It works. Thanks Jacob

"Jacob Skaria" wrote:

Oops; please ignore the previous post....

COUNT() is a worksheet function.So ..

Sub SettleAutoDue()

If WorksheetFunction.Count(Range("T4:T53")) < 0 Then
Worksheets("A-3").Range("U4:Z4").Copy
Range("G5").PasteSpecial Paste:=xlPasteValues, Transpose:=True
Application.CutCopyMode = False
Range("G4").Activate
End If

End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


" wrote:

Need help on this.

I don't want the Macro to work if [***IF COUNT(T4:T53) = 0 THEN EXIT SUB***]
inside the Macro below.


Sub SettleAutoDue()

***IF COUNT(T4:T53) = 0 THEN EXIT SUB***

Worksheets("A-3").Range("U4:Z4").Copy
Range("G5").PasteSpecial Paste:=xlPasteValues, Transpose:=True
Application.CutCopyMode = False
Range("G4").Activate

End Sub


Thank you.

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,480
Default Exit Sub if count less than zero.

Hi

If WorksheetFunction.Count(T4:T53) = 0 Then Exit Sub

--
Regards
Roger Govier

" wrote in
message ...
Need help on this.

I don't want the Macro to work if [***IF COUNT(T4:T53) = 0 THEN EXIT
SUB***]
inside the Macro below.


Sub SettleAutoDue()

***IF COUNT(T4:T53) = 0 THEN EXIT SUB***

Worksheets("A-3").Range("U4:Z4").Copy
Range("G5").PasteSpecial Paste:=xlPasteValues, Transpose:=True
Application.CutCopyMode = False
Range("G4").Activate

End Sub


Thank you.


  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,480
Default Exit Sub if count less than zero.

Apologies, type too fast and missed the Range
If WorksheetFunction.Count(Range("T4:T53")) = 0 Then Exit Sub

--
Regards
Roger Govier

" wrote in
message ...
Need help on this.

I don't want the Macro to work if [***IF COUNT(T4:T53) = 0 THEN EXIT
SUB***]
inside the Macro below.


Sub SettleAutoDue()

***IF COUNT(T4:T53) = 0 THEN EXIT SUB***

Worksheets("A-3").Range("U4:Z4").Copy
Range("G5").PasteSpecial Paste:=xlPasteValues, Transpose:=True
Application.CutCopyMode = False
Range("G4").Activate

End Sub


Thank you.


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 SUB UPON VBCANCEL FARAZ QURESHI Excel Discussion (Misc queries) 2 April 9th 09 12:38 PM
Cancel/Exit Sub Howard Excel Discussion (Misc queries) 3 December 16th 08 09:53 PM
Exit Sub Jeff Excel Discussion (Misc queries) 2 March 1st 08 06:21 PM
Run when exit PH NEWS Excel Worksheet Functions 1 July 18th 06 03:53 PM
on exit macro ditchy Excel Discussion (Misc queries) 2 May 3rd 05 12:11 AM


All times are GMT +1. The time now is 01:14 PM.

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

About Us

"It's about Microsoft Excel"