How to get the second to last value cell in a column?

danbates

Active Member
Joined
Oct 8, 2017
Messages
377
Office Version
  1. 2016
Platform
  1. Windows
Hi,

Please can someone help me?

I would like to get the second to last value in column C. I have this code so far but it just gets the last value.

Code:
TextBox3.Text = Range("C" & Rows.Count).End(xlUp).Text

Any help would be appreciated.

Thanks

Dan
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
numbers
8
4
7
6
3how to get the 9
4
99
7
=OFFSET(A1,SUMPRODUCT((A2:A21<>"")*1)-1,0)
counts how many rows, knocks off 1
goes down to that value
fails if there are any blank cells

<colgroup><col width="64" span="10" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0
Code:
TextBox3.Text = Range("C" & Rows.Count).End(xlUp).Offset(-1, 0).Text
 
Upvote 0
Thank you oldbrewer for your reply, but I am going to use mumps's version because it is exactly the code I was after.

Thank you again mumps for your help.

Regards

Dan
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

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