[SOLVED] How to use Index and match funtion in VBA


I would like to use the following function in VBA.


I use two tables. In the table "Data" in column C2:C I would like to transfer the searched results.
Can anyone help with VBA coding?


without having tested it myself now, shooting from the hip, the VBA replacement should be trivial:

public function zone(DBase as Range, Locale as String, Locales as Range, Service as String, Services as Range) as Variant
  Dim iLocale as Long
  iLocale = WorksheetFunction.Match(Locale,Locales,0)
  Dim iService as Long
  iService = WorksheetFunction.Match(Service,Services,0)
  zone = DBase(iLocale,iService)
end function

Needs error checking, of course. I find your motivation still rather suspect 😉 Personally, I would not do it. Your ambition to import the data from elsewhere will most probably also not work as you intend.

Answered By – Ollie2893

Answer Checked By – David Goodson (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *