Select Range of the last row

vostroxe

New Member
Joined
Jul 13, 2018
Messages
29
Below code only work to select single cell. Let say last row is row 50. How do I select range of last row between A50 to Z50.

Code:
Cells(LastRow + 1, "A").Select

Is it possible to combine below codes into single line?

Code:
Cells(LstRow, "C").Formula = "=SUM(C4:C" & LstRow - 1 & ")"
Code:
Cells(LstRow, "D").Formula = "=SUM(D4:D" & LstRow - 1 & ")"
Code:
Cells(LstRow, "E").Formula = "=SUM(E4:E" & LstRow - 1 & ")"
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Below code only work to select single cell. Let say last row is row 50. How do I select range of last row between A50 to Z50.

Code:
Cells(LastRow + 1, "A").Select

Is it possible to combine below codes into single line?

Code:
Cells(LstRow, "C").Formula = "=SUM(C4:C" & LstRow - 1 & ")"
Code:
Cells(LstRow, "D").Formula = "=SUM(D4:D" & LstRow - 1 & ")"
Code:
Cells(LstRow, "E").Formula = "=SUM(E4:E" & LstRow - 1 & ")"

I believe this is something you're looking for?
Rich (BB code):
Range("A1",range("Z100000").End(xlUp)).Select

You can use this to do pretty much anything.
Eg: You can input a formula into C1 and copy it down as manyrows as required with
Rich (BB code):
 Range(“C1”).Formula = “<INPUT FORMULA HERE>”
Rich (BB code):
Rich (BB code):
Rich (BB code):
Range(“C1”).Copy
Range(“C2”,range(“C100000”).End(xlUp)).PasteSpecial

Is this what you’re needing or am I not understanding yourpost?
 
Last edited:
Upvote 0
This will add the formulas 1 row below the last row
Code:
Range("A" & Rows.count).End(xlUp).Offset(1, 2).Resize(, 3).FormulaR1C1 = "=sum(r4c:r[-1]c)"
 
Upvote 0
RE: Your 1st Q: try code:
Code:
Sub foo()
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("A" & LR & ":Z" & LR).Select
End Sub
 
Upvote 0
This will add the formulas 1 row below the last row
Code:
Range("A" & Rows.count).End(xlUp).Offset(1, 2).Resize(, 3).FormulaR1C1 = "=sum(r4c:r[-1]c)"
I actually require the formula at the last row. What value do I have to amend if I want to extend up to column Z?
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top