Match Function to find last used cell in row

Buskopan

Board Regular
Joined
Aug 4, 2014
Messages
54
Hello

Range A to K contains cliens details (name adres etc)
Range L to BS conains months from 2011 to 2016 where indicated the paymants

2h2k30o.jpg


Range A1:BX1000 - Dynamic Range Named "LombardAll" contains clients contract numbers
So Combobox1 Rawsorce is "Lombard"
Depending on combobox1 value I want texbox1 to indicate the first unpaid month
2n8rb79.jpg

Question 1
How the code will look like ?

Question 2 (if 1 question was hard)
How can I get the cell number of vlookup result ?

Something like that results with error.
Code:
Private Sub ComboBox1_Change()
me.textbox1.value = "Row N " &  WorksheetFunction.Match(--Me.ComboBox1.Value, Worksheets("Esas").Range("LombardAll"), False)
End Sub

File. (just in case)
 
Last edited:

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Buskopan

Board Regular
Joined
Aug 4, 2014
Messages
54
did it finally this way

Code:
[COLOR=#000099][FONT=monospace]Private[/FONT][/COLOR][COLOR=#000000][FONT=monospace] [/FONT][/COLOR][COLOR=#000099][FONT=monospace]Sub[/FONT][/COLOR][COLOR=#000000][FONT=monospace] ComboBox1_Change()[/FONT][/COLOR]

[COLOR=#000000][FONT=monospace]st = WorksheetFunction.Match(--Me.ComboBox1.Value, Worksheets([/FONT][/COLOR][COLOR=#666666][FONT=monospace]"Esas"[/FONT][/COLOR][COLOR=#000000][FONT=monospace]).Range([/FONT][/COLOR][COLOR=#666666][FONT=monospace]"newtest"[/FONT][/COLOR][COLOR=#000000][FONT=monospace]), [/FONT][/COLOR][COLOR=#000099][FONT=monospace]False[/FONT][/COLOR][COLOR=#000000][FONT=monospace])[/FONT][/COLOR]
[COLOR=#000000][FONT=monospace]Me.lastPayment.Value = Range([/FONT][/COLOR][COLOR=#666666][FONT=monospace]"B"[/FONT][/COLOR][COLOR=#000000][FONT=monospace] & st).Value[/FONT][/COLOR]

[COLOR=#000000][FONT=monospace]lastcolumn = ActiveSheet.Range([/FONT][/COLOR][COLOR=#666666][FONT=monospace]"AP"[/FONT][/COLOR][COLOR=#000000][FONT=monospace] & st).End(xlToRight).Column[/FONT][/COLOR]
[COLOR=#000000][FONT=monospace]Me.TextBox1.Value = Cells(st, lastcolumn) [/FONT][/COLOR][COLOR=#006600][FONT=monospace]'[/FONT][/COLOR]
[COLOR=#000000][FONT=monospace]Me.TextBox2.Value = Cells([/FONT][/COLOR][COLOR=#CC0000][FONT=monospace]1[/FONT][/COLOR][COLOR=#000000][FONT=monospace], lastcolumn)[/FONT][/COLOR]

[COLOR=#000099][FONT=monospace]End[/FONT][/COLOR][COLOR=#000000][FONT=monospace] [/FONT][/COLOR][COLOR=#000099][FONT=monospace]Sub[/FONT][/COLOR]
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,951
Messages
5,834,548
Members
430,295
Latest member
amdis

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
Top