Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old November 20th 06, 09:03 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Dec 2006
Posts: 42
Default macro doesn't properly record AutoSum (and SendKeys doesn't work)

In my macro, I'm trying to "insert" an auto-sum command into various,
periodic cells. But when I record the keystrokes it always refers to a range
of cells (whether it's a relative or absolute address). So, that won't work
because it's a different range every time. I just want to execute an
auto-sum function into a balnk cell. But even SendKeys doesn't work. The
macro ignores the SendKeys command of: "alt-equals-enter."

Here's a description, in general:

In Column B, I have thousands of dollar-amounts, separated intermittently by
two blank cells. I need to sum the range of cells directly "above" the first
blank cell. My macro can "find" each blank cell in which the auto-sum should
occur -- that's no problem. But when I'm at the blank cell, I merely want to
perform an auto-sum. But I can't specify an exact range because the range
(number of cells) changes every time. So, in effect, I just want to "click"
the auto-sum icon. But, like I said above, "record macro" inserts the
specific row addresses (or relative range) and SendKeys doesn't work.

So, how can I program the macro to perform an auto-sum without specifying a
specific range of cells?

Thanks. Dan

  #2   Report Post  
Old November 20th 06, 11:15 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2006
Posts: 2,718
Default macro doesn't properly record AutoSum (and SendKeys doesn't work)

Sub SumAbove()
With ActiveCell
.Formula = "=sum(" & Range(.Offset(-1), _
.Offset(-1).End(xlUp)).Address(False, False) & ")"
End With
End Sub

--
Jim
"crimsonkng" wrote in message
...
| In my macro, I'm trying to "insert" an auto-sum command into various,
| periodic cells. But when I record the keystrokes it always refers to a
range
| of cells (whether it's a relative or absolute address). So, that won't
work
| because it's a different range every time. I just want to execute an
| auto-sum function into a balnk cell. But even SendKeys doesn't work. The
| macro ignores the SendKeys command of: "alt-equals-enter."
|
| Here's a description, in general:
|
| In Column B, I have thousands of dollar-amounts, separated intermittently
by
| two blank cells. I need to sum the range of cells directly "above" the
first
| blank cell. My macro can "find" each blank cell in which the auto-sum
should
| occur -- that's no problem. But when I'm at the blank cell, I merely want
to
| perform an auto-sum. But I can't specify an exact range because the range
| (number of cells) changes every time. So, in effect, I just want to
"click"
| the auto-sum icon. But, like I said above, "record macro" inserts the
| specific row addresses (or relative range) and SendKeys doesn't work.
|
| So, how can I program the macro to perform an auto-sum without specifying
a
| specific range of cells?
|
| Thanks. Dan


  #3   Report Post  
Old November 21st 06, 03:11 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Dec 2006
Posts: 42
Default macro doesn't properly record AutoSum (and SendKeys doesn't wo

Jim:

You are awesome. Thank you so much!

Dan

"Jim Rech" wrote:

Sub SumAbove()
With ActiveCell
.Formula = "=sum(" & Range(.Offset(-1), _
.Offset(-1).End(xlUp)).Address(False, False) & ")"
End With
End Sub

--
Jim
"crimsonkng" wrote in message
...
| In my macro, I'm trying to "insert" an auto-sum command into various,
| periodic cells. But when I record the keystrokes it always refers to a
range
| of cells (whether it's a relative or absolute address). So, that won't
work
| because it's a different range every time. I just want to execute an
| auto-sum function into a balnk cell. But even SendKeys doesn't work. The
| macro ignores the SendKeys command of: "alt-equals-enter."
|
| Here's a description, in general:
|
| In Column B, I have thousands of dollar-amounts, separated intermittently
by
| two blank cells. I need to sum the range of cells directly "above" the
first
| blank cell. My macro can "find" each blank cell in which the auto-sum
should
| occur -- that's no problem. But when I'm at the blank cell, I merely want
to
| perform an auto-sum. But I can't specify an exact range because the range
| (number of cells) changes every time. So, in effect, I just want to
"click"
| the auto-sum icon. But, like I said above, "record macro" inserts the
| specific row addresses (or relative range) and SendKeys doesn't work.
|
| So, how can I program the macro to perform an auto-sum without specifying
a
| specific range of cells?
|
| Thanks. Dan





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
Record Macro Relative does not work? lbbss Excel Discussion (Misc queries) 3 December 13th 04 09:43 PM
Record Macro Relative does not work? lbbss Excel Discussion (Misc queries) 1 December 13th 04 08:55 PM
Macro shortcut keys not work properly Matan Excel Programming 1 April 20th 04 02:15 PM
How to record macro to work on selected column/row? Olezhka Excel Programming 1 March 5th 04 08:30 PM
Macro recording does not work properly Office XP beginner Excel Programming 1 October 22nd 03 06:26 PM


All times are GMT +1. The time now is 09:23 AM.

Powered by vBulletin® Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2004-2019 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"

 

Copyright © 2017