Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.setup
G
 
Posts: n/a
Default Activate cell at end of range

I want to be able to automatically find the last cell in the range, offset
(1,0) and activate/select the cell to place the sum of the range. The code
below does not activate the cell at the end to properly place the total
amount. Any help is greatly appreciated!

Sub AddTotal()
With ActiveCell
Set Rng = Range("K8", Range("K8").End(xlDown))
.Formula = "=SUM(" & Rng.Address & ")"
End With
End Sub

G
  #2   Report Post  
Posted to microsoft.public.excel.setup
Bob Phillips
 
Posts: n/a
Default Activate cell at end of range

Sub AddTotal()
Set rng2 = Range("K8").End(xlDown)
Set rng = Range("K8", rng2)
rng2.Offset(1, 0).Formula = "=SUM(" & rng.Address & ")"
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"G" wrote in message
...
I want to be able to automatically find the last cell in the range, offset
(1,0) and activate/select the cell to place the sum of the range. The

code
below does not activate the cell at the end to properly place the total
amount. Any help is greatly appreciated!

Sub AddTotal()
With ActiveCell
Set Rng = Range("K8", Range("K8").End(xlDown))
.Formula = "=SUM(" & Rng.Address & ")"
End With
End Sub

G



  #3   Report Post  
Posted to microsoft.public.excel.setup
G
 
Posts: n/a
Default Activate cell at end of range

Thanks for your quick response! The coding definitely works!

"Bob Phillips" wrote:

Sub AddTotal()
Set rng2 = Range("K8").End(xlDown)
Set rng = Range("K8", rng2)
rng2.Offset(1, 0).Formula = "=SUM(" & rng.Address & ")"
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"G" wrote in message
...
I want to be able to automatically find the last cell in the range, offset
(1,0) and activate/select the cell to place the sum of the range. The

code
below does not activate the cell at the end to properly place the total
amount. Any help is greatly appreciated!

Sub AddTotal()
With ActiveCell
Set Rng = Range("K8", Range("K8").End(xlDown))
.Formula = "=SUM(" & Rng.Address & ")"
End With
End Sub

G




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
How do I change a cell range with a reference cell? Danneskjold Excel Discussion (Misc queries) 2 August 11th 05 07:37 PM
How do I refer a Range to a Cell Mal Excel Worksheet Functions 6 June 7th 05 08:47 AM
Reveal cell formats and extendable range in tool/statusbar/icon. Danny O'Hern ([email protected]) Excel Worksheet Functions 0 April 29th 05 01:16 PM
Counting spefic cell (not a range) with a value greater than 1 mmock Excel Discussion (Misc queries) 5 April 27th 05 02:34 PM
How can I assign a range starting cell based on a variable locati. feman007 Excel Worksheet Functions 3 March 10th 05 12:40 AM


All times are GMT +1. The time now is 11:17 AM.

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

About Us

"It's about Microsoft Excel"