Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Display Empty Cell When Using SUM formula

I am using a Custom Sales Order Template. I use a macro to clear contents
(from previous sales order). I use SUM formula in the TOTAL cell and wonder
if I can have the TOTAL cell show as empty (but leave formula intact) after
macro clears contents. I am being picky here, I know.

Here is Macro:

Sub NewSalesOrder()
'
' NewSalesOrder Macro
' Clears Sales Order for new data entry
'
' Keyboard Shortcut: Ctrl+b
'
Range("B2").Select
Selection.ClearContents
Range("B4:B13").Select
Selection.ClearContents
Range("E14").Select
Selection.ClearContents
End Sub

--
Thanks from Salt Spring
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Display Empty Cell When Using SUM formula

Is the Total cell one of the cells cleared in your macro?

If so, why clear (delete) the formula? Just write the formula like this:

=IF(SUM(.....)=0,"",SUM(.....))

And remove that cell reference from your macro.

Also, you can simplify the macro to:

Sub NewSalesOrder()
Range("B2,B4:B13,E14").ClearContents
End Sub

--
Biff
Microsoft Excel MVP


"Koomba" wrote in message
...
I am using a Custom Sales Order Template. I use a macro to clear contents
(from previous sales order). I use SUM formula in the TOTAL cell and
wonder
if I can have the TOTAL cell show as empty (but leave formula intact)
after
macro clears contents. I am being picky here, I know.

Here is Macro:

Sub NewSalesOrder()
'
' NewSalesOrder Macro
' Clears Sales Order for new data entry
'
' Keyboard Shortcut: Ctrl+b
'
Range("B2").Select
Selection.ClearContents
Range("B4:B13").Select
Selection.ClearContents
Range("E14").Select
Selection.ClearContents
End Sub

--
Thanks from Salt Spring



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,344
Default Display Empty Cell When Using SUM formula

Hi,

You can use the formula:

IF(SUM(B4:B13),SUM(B4:B13),"")

or you can leave the original formula and choose Tools, Options, View tab,
and uncheck Zero values.

or you can applly a custom format like #,##0_);(#,##0);; to the cells.


--
Thanks,
Shane Devenshire


"Koomba" wrote:

I am using a Custom Sales Order Template. I use a macro to clear contents
(from previous sales order). I use SUM formula in the TOTAL cell and wonder
if I can have the TOTAL cell show as empty (but leave formula intact) after
macro clears contents. I am being picky here, I know.

Here is Macro:

Sub NewSalesOrder()
'
' NewSalesOrder Macro
' Clears Sales Order for new data entry
'
' Keyboard Shortcut: Ctrl+b
'
Range("B2").Select
Selection.ClearContents
Range("B4:B13").Select
Selection.ClearContents
Range("E14").Select
Selection.ClearContents
End Sub

--
Thanks from Salt Spring

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 79
Default Display Empty Cell When Using SUM formula


Assuming that your Total is in F14, I simply your macro and add a total
formula
in F14. Adjust to suit yours.

Sub Clear()
'
Range("B2,B4:B13,E14").ClearContents
Range("F14").Formula = "=IF(SUM(B4:B13)=0,"""",SUM(B4:B13))"

End Sub

Regards,



"Koomba" wrote:

I am using a Custom Sales Order Template. I use a macro to clear contents
(from previous sales order). I use SUM formula in the TOTAL cell and wonder
if I can have the TOTAL cell show as empty (but leave formula intact) after
macro clears contents. I am being picky here, I know.

Here is Macro:

Sub NewSalesOrder()
'
' NewSalesOrder Macro
' Clears Sales Order for new data entry
'
' Keyboard Shortcut: Ctrl+b
'
Range("B2").Select
Selection.ClearContents
Range("B4:B13").Select
Selection.ClearContents
Range("E14").Select
Selection.ClearContents
End Sub

--
Thanks from Salt Spring

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,345
Default Display Empty Cell When Using SUM formula

Before Harlan jumps in and being more picky than even the OP, would it not
be better to use:

=IF(COUNT(.....)=0,"",SUM(.....))

I know that it is a Sales Order Template but I suppose that it is always
possible that if there was a cancelled order, the credit note is entered as
a negative.

--

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"T. Valko" wrote in message
...
Is the Total cell one of the cells cleared in your macro?

If so, why clear (delete) the formula? Just write the formula like this:

=IF(SUM(.....)=0,"",SUM(.....))

And remove that cell reference from your macro.

Also, you can simplify the macro to:

Sub NewSalesOrder()
Range("B2,B4:B13,E14").ClearContents
End Sub

--
Biff
Microsoft Excel MVP


"Koomba" wrote in message
...
I am using a Custom Sales Order Template. I use a macro to clear contents
(from previous sales order). I use SUM formula in the TOTAL cell and
wonder
if I can have the TOTAL cell show as empty (but leave formula intact)
after
macro clears contents. I am being picky here, I know.

Here is Macro:

Sub NewSalesOrder()
'
' NewSalesOrder Macro
' Clears Sales Order for new data entry
'
' Keyboard Shortcut: Ctrl+b
'
Range("B2").Select
Selection.ClearContents
Range("B4:B13").Select
Selection.ClearContents
Range("E14").Select
Selection.ClearContents
End Sub

--
Thanks from Salt Spring








  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Display Empty Cell When Using SUM formula

I don't know....six of one, half dozen of the other!

SUM saves you 2 keystrokes and you could eliminate the =0 to save 2 more!

--
Biff
Microsoft Excel MVP


"Sandy Mann" wrote in message
...
Before Harlan jumps in and being more picky than even the OP, would it not
be better to use:

=IF(COUNT(.....)=0,"",SUM(.....))

I know that it is a Sales Order Template but I suppose that it is always
possible that if there was a cancelled order, the credit note is entered
as a negative.

--

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"T. Valko" wrote in message
...
Is the Total cell one of the cells cleared in your macro?

If so, why clear (delete) the formula? Just write the formula like this:

=IF(SUM(.....)=0,"",SUM(.....))

And remove that cell reference from your macro.

Also, you can simplify the macro to:

Sub NewSalesOrder()
Range("B2,B4:B13,E14").ClearContents
End Sub

--
Biff
Microsoft Excel MVP


"Koomba" wrote in message
...
I am using a Custom Sales Order Template. I use a macro to clear contents
(from previous sales order). I use SUM formula in the TOTAL cell and
wonder
if I can have the TOTAL cell show as empty (but leave formula intact)
after
macro clears contents. I am being picky here, I know.

Here is Macro:

Sub NewSalesOrder()
'
' NewSalesOrder Macro
' Clears Sales Order for new data entry
'
' Keyboard Shortcut: Ctrl+b
'
Range("B2").Select
Selection.ClearContents
Range("B4:B13").Select
Selection.ClearContents
Range("E14").Select
Selection.ClearContents
End Sub

--
Thanks from Salt Spring








  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Display Empty Cell When Using SUM formula

Thanks for taking me a step further
--
Thanks from Salt Spring


"T. Valko" wrote:

Is the Total cell one of the cells cleared in your macro?

If so, why clear (delete) the formula? Just write the formula like this:

=IF(SUM(.....)=0,"",SUM(.....))

And remove that cell reference from your macro.

Also, you can simplify the macro to:

Sub NewSalesOrder()
Range("B2,B4:B13,E14").ClearContents
End Sub

--
Biff
Microsoft Excel MVP


"Koomba" wrote in message
...
I am using a Custom Sales Order Template. I use a macro to clear contents
(from previous sales order). I use SUM formula in the TOTAL cell and
wonder
if I can have the TOTAL cell show as empty (but leave formula intact)
after
macro clears contents. I am being picky here, I know.

Here is Macro:

Sub NewSalesOrder()
'
' NewSalesOrder Macro
' Clears Sales Order for new data entry
'
' Keyboard Shortcut: Ctrl+b
'
Range("B2").Select
Selection.ClearContents
Range("B4:B13").Select
Selection.ClearContents
Range("E14").Select
Selection.ClearContents
End Sub

--
Thanks from Salt Spring




  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Display Empty Cell When Using SUM formula

To all who have sent solutions, thank you. Your suggestions are helping me in
a very big way. I will always try and find my solutions before imposing on
you all.
--
Thanks from Salt Spring


"franciz" wrote:


Assuming that your Total is in F14, I simply your macro and add a total
formula
in F14. Adjust to suit yours.

Sub Clear()
'
Range("B2,B4:B13,E14").ClearContents
Range("F14").Formula = "=IF(SUM(B4:B13)=0,"""",SUM(B4:B13))"

End Sub

Regards,



"Koomba" wrote:

I am using a Custom Sales Order Template. I use a macro to clear contents
(from previous sales order). I use SUM formula in the TOTAL cell and wonder
if I can have the TOTAL cell show as empty (but leave formula intact) after
macro clears contents. I am being picky here, I know.

Here is Macro:

Sub NewSalesOrder()
'
' NewSalesOrder Macro
' Clears Sales Order for new data entry
'
' Keyboard Shortcut: Ctrl+b
'
Range("B2").Select
Selection.ClearContents
Range("B4:B13").Select
Selection.ClearContents
Range("E14").Select
Selection.ClearContents
End Sub

--
Thanks from Salt Spring

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Display Empty Cell When Using SUM formula

You're welcome!

--
Biff
Microsoft Excel MVP


"Koomba" wrote in message
...
Thanks for taking me a step further
--
Thanks from Salt Spring


"T. Valko" wrote:

Is the Total cell one of the cells cleared in your macro?

If so, why clear (delete) the formula? Just write the formula like this:

=IF(SUM(.....)=0,"",SUM(.....))

And remove that cell reference from your macro.

Also, you can simplify the macro to:

Sub NewSalesOrder()
Range("B2,B4:B13,E14").ClearContents
End Sub

--
Biff
Microsoft Excel MVP


"Koomba" wrote in message
...
I am using a Custom Sales Order Template. I use a macro to clear
contents
(from previous sales order). I use SUM formula in the TOTAL cell and
wonder
if I can have the TOTAL cell show as empty (but leave formula intact)
after
macro clears contents. I am being picky here, I know.

Here is Macro:

Sub NewSalesOrder()
'
' NewSalesOrder Macro
' Clears Sales Order for new data entry
'
' Keyboard Shortcut: Ctrl+b
'
Range("B2").Select
Selection.ClearContents
Range("B4:B13").Select
Selection.ClearContents
Range("E14").Select
Selection.ClearContents
End Sub

--
Thanks from Salt Spring






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
format a cell with a formula so an empty reference cell shows blan M2 Excel Discussion (Misc queries) 3 November 7th 06 10:42 PM
formula, move to previous cell when the current cell=0 or empty osama amer Excel Discussion (Misc queries) 0 May 29th 06 12:18 PM
How do I leave formula cell blank if 2nd reference cell is empty? Liana S Excel Discussion (Misc queries) 2 October 21st 05 04:38 PM
How do I set a cell to "Empty" so that it does not display in a ch Ian Charts and Charting in Excel 3 January 7th 05 01:12 AM
Display a dialog box if cell is empty jst Excel Discussion (Misc queries) 2 December 28th 04 11:59 AM


All times are GMT +1. The time now is 01:48 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"