Help amending VBA Code

purceld2

Well-known Member
Joined
Aug 18, 2005
Messages
586
Office Version
  1. 2013
Platform
  1. Windows
Hi

In theory it should be simple but I cannot seem to get it to work. The VBA below correctly retrieve a date, what I would like to do is to also retrieve two extra bits of data from the same row.

Which The "Territory Map Number" and "Territory Map Name" on the same row.

Could someone show how this can be done please.


VBA Code:
Sub LastDate1()
Dim Max_date As Date
Max_date = [MIN(IF(D3:D36<>"ALLOCATED",C3:C36))]
MsgBox Max_date
End Sub

 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
How about this?

VBA Code:
Sub LastDate1()
x = [INDEX(A2:A11 & ": " &  B2:B11,MATCH(MIN(IF(D2:D11<>"ALLOCATED",C2:C11)),C2:C11,0))]
MsgBox x(1)
End Sub
 
Upvote 0
How about this?

VBA Code:
Sub LastDate1()
x = [INDEX(A2:A11 & ": " &  B2:B11,MATCH(MIN(IF(D2:D11<>"ALLOCATED",C2:C11)),C2:C11,0))]
MsgBox x(1)
End Sub
Hi Irobbo
Thanks so much for your prompt reply and worked just fine, just one some issue it displays everything except the date could you amend to include this please
 
Upvote 0
How about...

VBA Code:
Sub LastDate1()
x = [INDEX(A2:A11 & ": " & B2:B11 & " - " & TEXT(C2:C11,"MM/DD/YYYY"),MATCH(MIN(IF(D2:D11<>"ALLOCATED",C2:C11)),C2:C11,0))]
MsgBox x(1)
End Sub
 
Upvote 0
How about...

VBA Code:
Sub LastDate1()
x = [INDEX(A2:A11 & ": " & B2:B11 & " - " & TEXT(C2:C11,"MM/DD/YYYY"),MATCH(MIN(IF(D2:D11<>"ALLOCATED",C2:C11)),C2:C11,0))]
MsgBox x(1)
End Sub
Perfect
Thanks for all your help
 
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,047
Members
449,206
Latest member
Healthydogs

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