#1   Report Post  
Posted to microsoft.public.excel.programming
BAS BAS is offline
external usenet poster
 
Posts: 14
Default Macros

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macros

Sub Addcolumns()

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

End Sub


"BAS" wrote:

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.

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
Macros in Personal.xls that would create two toolbars and buttonswith assigned macros Brian Day Excel Programming 1 March 29th 07 11:20 PM
choose default macros Not Enabled / Macros Enable Setting BEEJAY Excel Programming 2 June 30th 06 01:07 PM
weird saving of a document with macros resulting with macros being transfered to the copy alfonso gonzales Excel Programming 0 December 12th 04 09:19 PM
Macros inside macros, and pasting into macro code. pagelocator[_2_] Excel Programming 1 November 24th 04 09:11 AM
convert lotus 123w macros to excel macros rpiescik Excel Programming 1 September 18th 04 01:35 PM


All times are GMT +1. The time now is 10:06 PM.

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"