View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Application.Match problem

Hi,

Am Sun, 26 Jul 2015 04:23:12 -0700 (PDT) schrieb
:

Sorry for bothering you i'm new in VBA
I am trying to use the MATCH function in VBA to search for a particular hour in a range containing hours and return the matching column number
that give me Error N°13 so thank you for your help


try:

Sub test()
Dim dt As Double
Dim A As Long

dt = CDbl(Sheets("Standard d'engagement").Cells(3, 4))
With Sheets("F. Regulation")
A = Application.Match(dt, .Range("B2:EP2"), 0)
End With
MsgBox (A)
End Sub

How did you create the times in sheet "F. Regulation"?
If you did it with a formula then try it with:
A = Application.Match(dt, .Range("B2:EP2"), 1)


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional