Macros

  • Thread starter Thread starter BAS
  • Start date Start date
B

BAS

hi,
I would like to know how to define a macro that checks column A,
(1) if non-empty, adds all the values present in it
(2) if empty, jumps to column B and adds the values present there.

I tried it out but with no success. Can somebody help please?
Its pretty urgent.

Thanking you in advance.
 
Sub Addcolumns()

total = WorksheetFunction.Sum(Columns("A"))
If total = 0 Then
total = WorksheetFunction.Sum(Columns("B"))
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top