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:
[TABLE="width: 176"]
<tbody>[TR]
[TD]FMGP-2019-5672[/TD]
[/TR]
[TR]
[TD]FMGP-2019-5673[/TD]
[/TR]
[TR]
[TD]FMGP-2019-5674
.
.
.
.
.
.[/TD]
[/TR]
[TR]
[TD]FMGP-2019-5681[/TD]
[/TR]
[TR]
[TD]*Last reference number will be FMGP-2019-5675[/TD]
[/TR]
</tbody>[/TABLE]


Thank you.
Anton
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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).
[TABLE="width: 176"]
<colgroup><col></colgroup><tbody>[TR]
[TD]
Column A:
FMGP-2019-5672[/TD]
[/TR]
[TR]
[TD]FMGP-2019-5673[/TD]
[/TR]
[TR]
[TD]FMGP-2019-5674[/TD]
[/TR]
[TR]
[TD]FMGP-2019-5675[/TD]
[/TR]
[TR]
[TD]FMGP-2019-5676[/TD]
[/TR]
[TR]
[TD]FMGP-2019-5677[/TD]
[/TR]
[TR]
[TD]FMGP-2019-5678[/TD]
[/TR]
[TR]
[TD]FMGP-2019-5679[/TD]
[/TR]
[TR]
[TD]FMGP-2019-5680[/TD]
[/TR]
[TR]
[TD]FMGP-2019-5681


Last Reference #:
FMGP-2019-5681[/TD]
[/TR]
</tbody>[/TABLE]
 
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,224,832
Messages
6,181,231
Members
453,026
Latest member
cknader

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