LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Summing a range without making it active

Hi

I'm trying to sum the total of one column in a variable row length range starting from cell E49.

After my other code has executed the active cell would normally be beneath the last cell in Col C (let's say C101 for example).

How would I enter the formula in E101 that would total all the cells in Col E from E49 to the end of the column (in this instance E100) without (a) selecting cells in Col E to establish the top and bottom row numbers and (b) hard coding the column reference i.e "E" in the code?

The extract of my current code is as follows:

Dim SelRow1, SelRow2 as Integer

Range("E49").Select
Let SelRow1 = Selection.Row
Selection.End(xlDown).Select
Let SelRow2 = Selection.Row
Selection.Offset(1, 0).Select
Let Selection.Formula = "=sum(E" & SelRow1 & ":" & "E" & SelRow2 & ")"

It works but I don't like hard coding the column reference as I want to be able to re-use the code without editing the Let Selection.Formula = line every time.

Thanks for any suggestions.

Garry Douglas

** Please Remove SPMOFF to 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
Making a specific row number active from a cell entry Bilbo Baggs Excel Discussion (Misc queries) 15 May 24th 10 06:29 PM
Info from one cell making other cells active Bambi Williams Excel Worksheet Functions 1 April 9th 08 05:49 PM
Making Hyperlinks Active In Entire Column JXD New Users to Excel 2 January 18th 06 11:28 PM
Making an active cell the first one to appear on the spreadsheet Bob Reynolds[_2_] Excel Programming 1 February 6th 04 04:47 PM
Saving an external file without making it active JENNA Excel Programming 2 January 17th 04 11:51 PM


All times are GMT +1. The time now is 03:35 AM.

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"