Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.setup
|
|||
|
|||
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
Posted to microsoft.public.excel.setup
|
|||
|
|||
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
Posted to microsoft.public.excel.setup
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I change a cell range with a reference cell? | Excel Discussion (Misc queries) | |||
How do I refer a Range to a Cell | Excel Worksheet Functions | |||
Reveal cell formats and extendable range in tool/statusbar/icon. | Excel Worksheet Functions | |||
Counting spefic cell (not a range) with a value greater than 1 | Excel Discussion (Misc queries) | |||
How can I assign a range starting cell based on a variable locati. | Excel Worksheet Functions |