1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
Set cWB = ThisWorkbook
With oExcel
.Visible = True
Set WB = .Workbooks.Open(sFile)
Set WS = WB.Worksheets(CONST_DATA_SHEET_NAME)
Set cWS = cWB.Worksheets(CONST_DATA_SHEET_NAME)
With cWS
.Select
Set cRNG = .Range(.Cells(CONST_VAR_IDX_START_ROW, CONST_VAR_IDX_COLUMN), _
.Cells(CONST_VAR_IDX_START_ROW, CONST_VAR_IDX_COLUMN).End(xlDown))
'.Cells(.Cells(Rows.Count, "B").End(xlDown).Row, 2))
With cRNG
For Each cCursor In cRNG
'cWB.Activate
Debug.Print cCursor.Value
'WB.Activate
With WB
.Activate
With WS
.Select
Set RNG = .Range(.Cells(CONST_VAR_IDX_START_ROW, CONST_VAR_IDX_COLUMN), _
.Cells(CONST_VAR_IDX_START_ROW, CONST_VAR_IDX_COLUMN).End(xlDown))
RNG.Select
'Set myCell = Selection.Find(What:=cCursor.Text, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlDown, _
MatchCase:=False, SearchFormat:=False)
Set myCell = Selection.Find(What:=cCursor.Text, After:=ActiveCell)
If myCell Is Nothing Then
'do nothing...
Else
Debug.Print myCell.Row
End If
Set RNG = Nothing
Set myCell = Nothing
End With
End With
Next
End With
End With
'WB.Activate
'closeExcel False
'.Quit
End With |
Partager