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:

Some videos you may like

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

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]
 

Watch MrExcel Video

Forum statistics

Threads
1,123,295
Messages
5,600,789
Members
414,405
Latest member
Zaurb

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