View Single Post
  #9   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 05:27:22 -0700 (PDT) schrieb Mohamed Elamrani:

I used Min to initiate the program and to find the smaller hour within different rows in the column XXX


I don't know where the error is.
Try it this way:

Sub vol()

Dim min As Long, INTL As Long, i As Long, j As Long
Dim dt As Double
min = 3000
Dim A As Long
With Sheets("F. Regulation")
For INTL = 0 To 20
If CLng(Sheets("Standard d'engagement").Cells(3 + INTL, 4)) <
min And Sheets("Standard d'engagement").Cells(3 + INTL, 4) < "" Then
min = CLng(Sheets("Standard d'engagement").Cells(3 + INTL,
4))
i = INTL
End If
Next

dt = Sheets("Standard d'engagement").Cells(3 + i, 4)
'Cells(3, dt, Range("B2:EP2"), 0)) = X
On Error Resume Next
For j = 0 To 18
A = Application.Match(dt, .Range("B2:EP2"), 1)
If .Cells(j + 3, Application.Match(dt, .Range("B2:EP2"), 1)) =
"" Then
For i = i To i + 13
.Cells(j + 3, Application.Match(CDbl(Sheets("Standard
d'engagement").Cells(3 + i, 4)), .Range("B2:EP2"), 1)) = "X"
Next
End If
Next

Sheets("Standard d'engagement").Cells(3 + i, 4).ClearContents
End With
End Sub


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