Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro with =SUM doesn't work


Hi, I have been trying to create a simple macro and assign it to
"button" so that when the button is clicked, it will add up a colum
containing currency figures and place the total in a selected cell.
have had NO success so far and I am hoping someone can assist me.

I am using M/S Office Excel 2003 v. 11.6113.5703

I use <TOOLS<MACRO<RECORD NEW MACRO and then click the OK button.
select cell S2 and record the following macro:

=SUM(N2:N84)

After I hit enter (which BTW, gives me the correct total), I push th
'stop recording' button.

I then select the 'button' from the toolbox and draw a button on th
worksheet. As soon as I let go with the mouse, the 'Assign Macro
window pops up and I assign the macro I just recorded to the button.

Now, since cell S2 contains the correct amount from when I recorded th
macro, I select S3 and push my new macro button. What happens is this:

As I move down column S, pushing the button as I come to each cell,
notice that in the 'function window' just below the toolbars, th
formula is changing by '1' with each click of the button. ie:

=SUM(N3:N85)
=SUM(N4:N86)
=SUM(N5:N87)...and so on.

This is creating a situation where, as I move down the worksheet, th
totals are all different and they should be the same!!

HELP

--
leopardhaw
-----------------------------------------------------------------------
leopardhawk's Profile: http://www.excelforum.com/member.php...fo&userid=2389
View this thread: http://www.excelforum.com/showthread.php?threadid=37531

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro with =SUM doesn't work


If you post the VBA code, it'll be easier for us to spot the problem.

Regards,
Ro

--
Ron Coderr
-----------------------------------------------------------------------
Ron Coderre's Profile: http://www.excelforum.com/member.php...fo&userid=2141
View this thread: http://www.excelforum.com/showthread.php?threadid=37531

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro with =SUM doesn't work


As requested....

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 5/31/2005 by Mark
'

'
Range("S3").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-1]C[-5]:R[81]C[-5])"
Range("S4").Select
End Sub


--
leopardhawk
------------------------------------------------------------------------
leopardhawk's Profile: http://www.excelforum.com/member.php...o&userid=23897
View this thread: http://www.excelforum.com/showthread...hreadid=375315

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro with =SUM doesn't work


Try this:

Sub Macro3()
ActiveCell.Formula = "=SUM(N2:N84)"
End Sub


Does that help?

Ron


--
Ron Coderre
------------------------------------------------------------------------
Ron Coderre's Profile: http://www.excelforum.com/member.php...o&userid=21419
View this thread: http://www.excelforum.com/showthread...hreadid=375315

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro with =SUM doesn't work


Well LO & BEHOLD! It works fine...

Thanks Ron...

I spent so much time on this and it is soooooo simple.

Well, I guess it helps to know programming.

Thanks again for your help.

Mark


--
leopardhawk
------------------------------------------------------------------------
leopardhawk's Profile: http://www.excelforum.com/member.php...o&userid=23897
View this thread: http://www.excelforum.com/showthread...hreadid=375315



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro with =SUM doesn't work

Sub Macro6()
ActiveCell.Formula = "=Sum($N$2:$N$84)"
End Sub

--
Regards,
Tom Ogilvy

"leopardhawk"
wrote in message
...

Hi, I have been trying to create a simple macro and assign it to a
"button" so that when the button is clicked, it will add up a column
containing currency figures and place the total in a selected cell. I
have had NO success so far and I am hoping someone can assist me.

I am using M/S Office Excel 2003 v. 11.6113.5703

I use <TOOLS<MACRO<RECORD NEW MACRO and then click the OK button. I
select cell S2 and record the following macro:

=SUM(N2:N84)

After I hit enter (which BTW, gives me the correct total), I push the
'stop recording' button.

I then select the 'button' from the toolbox and draw a button on the
worksheet. As soon as I let go with the mouse, the 'Assign Macro'
window pops up and I assign the macro I just recorded to the button.

Now, since cell S2 contains the correct amount from when I recorded the
macro, I select S3 and push my new macro button. What happens is this:

As I move down column S, pushing the button as I come to each cell, I
notice that in the 'function window' just below the toolbars, the
formula is changing by '1' with each click of the button. ie:

=SUM(N3:N85)
=SUM(N4:N86)
=SUM(N5:N87)...and so on.

This is creating a situation where, as I move down the worksheet, the
totals are all different and they should be the same!!

HELP!


--
leopardhawk
------------------------------------------------------------------------
leopardhawk's Profile:

http://www.excelforum.com/member.php...o&userid=23897
View this thread: http://www.excelforum.com/showthread...hreadid=375315



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
Macro to sum doesn't work RM270 Excel Discussion (Misc queries) 2 March 17th 10 05:55 PM
Macro to update a column in a work based on another work sheet WickerMan New Users to Excel 1 December 4th 09 12:58 PM
Macro works Macro does not work Wanna Learn Excel Discussion (Misc queries) 4 March 24th 08 12:51 PM
Why Won't This Macro Work? Pausert of Nikkeldepaiin Excel Discussion (Misc queries) 7 February 4th 08 01:05 PM
Macro won't work on other PCs - HELP! Big Chris[_36_] Excel Programming 5 August 13th 04 12:21 AM


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