Capture the last Reference no.

anthonymedz

Board Regular
Joined
Jan 30, 2015
Messages
69
Hi Guys,

Good day.
Can someone help me on my little project.
I have plenty series of Reference number that need to update every day and i would like to capture the last reference number just to remind me that that is the last ref number.
For example:
FMGP-2019-5672
FMGP-2019-5673
FMGP-2019-5674
.
.
.
.
.
.
FMGP-2019-5681
*Last reference number will be FMGP-2019-5675

<tbody>
</tbody>


Thank you.
Anton
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Re: How to capture the last Reference no.

Where is this data?

Is this in sheet named Master Column A

And how do you want to capture it. Your words.

Do you mean displayed in a Popup Message box

And I would think lastone would be:
2019-5681
 
Upvote 0
Re: How to capture the last Reference no.

Yes it is in Master Column A and just simply will displayed the reference number in a certain row like(C6).

Column A:
FMGP-2019-5672
FMGP-2019-5673
FMGP-2019-5674
FMGP-2019-5675
FMGP-2019-5676
FMGP-2019-5677
FMGP-2019-5678
FMGP-2019-5679
FMGP-2019-5680
FMGP-2019-5681


Last Reference #:
FMGP-2019-5681

<colgroup><col></colgroup><tbody>
</tbody>
 
Upvote 0
Re: How to capture the last Reference no.

Try this.

Assuming we are running the script from the active sheet.

Code:
Sub Display_Last_Value_Column_A()
'Modified 1/27/2019 4:04:33 AM  EST
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Range("C6").Value = Cells(Lastrow, 1).Value
End Sub
 
Upvote 0
Re: How to capture the last Reference no.

Or could just put a formula in C6 : =LOOKUP(2,1/(A:A<>""),A:A)
 
Upvote 0
Re: How to capture the last Reference no.

Try this.

Assuming we are running the script from the active sheet.

Code:
Sub Display_Last_Value_Column_A()
'Modified 1/27/2019 4:04:33 AM  EST
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Range("C6").Value = Cells(Lastrow, 1).Value
End Sub

Hi Sir,
What if instead of Column A i want to select on certain column(A14:A35) on the active sheet?
thanks
 
Upvote 0
Re: How to capture the last Reference no.

Are you saying you want the script to find the last value in the Range("A14"A35")

And put that value in Rage("C6")

If this something you need for a much larger script?
 
Upvote 0
Re: How to capture the last Reference no.

Yes that's what i need sir.

I tried to help because your original question was simple for me.
For example if one cell in that range is empty is that the last row with data
Or maybe three different cells in that range are empty what cell is the last one.



This is beyond my knowledgebase.
I will continue to monitor this thread to see what I can learn.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,731
Messages
6,126,539
Members
449,316
Latest member
sravya

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