check this out Public Sub test()
Dim dt As Variant dt = Sheets(1).Cells(3, 4) MsgBox dt A = Application.Match(dt, Range("B2:EP2"), 0) MsgBox (A) End Sub Regards, Mandeep Baluja On Sunday, July 26, 2015 at 5:00:04 PM UTC+5:30, Mohamed Elamrani wrote: > > 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 > > Public Sub test() > With Sheets("F. Regulation") > Dim dt As Double > dt = Sheets("Standard d'engagement").Cells(3, 4) > A = Application.Match(CLng(dt), Range("B2:EP2"), 0) > MsgBox (A) > End With > End Sub > -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.