Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / March 2008

Tip: Looking for answers? Try searching our database.

sum by coding without 0

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kaja - 01 Mar 2008 10:51 GMT
hi

in the following program if there is no value in the cells a1 and b1
it returns 0

Public Sub Add2Cells()
     Range("C1").Value = Range("A1").Value + Range("B1").Value
  End Sub
i need only the output if the both the cells have the data will you
can tell me that
Bob Phillips - 01 Mar 2008 15:34 GMT
Public Sub Add2Cells()
   If Range("A1").Value <> "" And .Range("B1").Value <> "" Then
        Range("C1").Value = Range("A1").Value + Range("B1").Value
   End If
End Sub

Signature

HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

> hi
>
[quoted text clipped - 6 lines]
> i need only the output if the both the cells have the data will you
> can tell me that
JMB - 01 Mar 2008 15:52 GMT
I think you included an extra period
.Range("B1").Value <> ""
probably s/b
Range("B1").Value <> ""

> Public Sub Add2Cells()
>     If Range("A1").Value <> "" And .Range("B1").Value <> "" Then
[quoted text clipped - 12 lines]
> > i need only the output if the both the cells have the data will you
> > can tell me that

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.