- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 1# jesscc - Sub Test()
- Dim D As Object, Ky As Variant
- Set D = CreateObject("Scripting.Dictionary")
- With Sheets("DATA")
- For Each Ky In Range(.[B5], .[B5].End(xlDown))
- D(Ky.Value) = Array(Ky.Offset(0, 2), Ky.Offset(0, 4))
- '=> D(Ky.Value) =Array( Ky.Cells(1, 3), Ky.Cells(1, 5))
- '=> D(Ky.Value) = Array(Ky(1, 3), Ky(1, 5))
- Next
- End With
- With Sheets("Sheet2")
- If .Range("E7").End(xlDown).Row = Rows.Count Then Exit Sub
- For Each Ky In .Range(.[E7], .[E7].End(xlDown))
- If D.Exists(Ky.Value) Then
- If D(Ky.Value)(1) Like "*C" Then
- Ky.Offset(0, 7) = D(Ky.Value)(0) '=> .Cells(E.Row, "L")= D(Ky.Value)(0)
- If Ky.Offset(0, 8) = "" Then 'Range("O7:O" & yRow).Formula = "=N7*1000/L7"
- Ky.Offset(0, 10) = Ky.Offset(0, 9) * 1000 / Ky.Offset(0, 7)
- '=> .Cells(e.Row, "O")=.Cells(e.Row, "N")*1000/.Cells(e.Row, "L")
- Else 'Range("O7:O" & yRow).Formula = "=M7*L7"
- Ky.Offset(0, 10) = Ky.Offset(0, 8) * Ky.Offset(0, 7)
- '=> .Cells(E.Row, "O") = .Cells(E.Row, "M") * .Cells(E.Row, "L")
- End If
- End If
- End If
- Next
- End With
- End Sub
½Æ»s¥N½X- Sub Ex()
- Dim Ar(), E As Range, W As Variant
- With Sheets("DATA")
- Ar = .Range("B5:F" & .[B4].End(xlDown).Row).Value
- End With
- Ar = Application.WorksheetFunction.Transpose(Ar)
- With Sheets("SHEET2")
- For Each E In .Range("E7", .[E7].End(xlDown))
- W = Application.Match(E, Application.Index(Ar, 1), 0)
- If IsNumeric(W) Then
- If Application.Index(Ar, 5)(W) Like "*C" Then
- .Cells(E.Row, "L") = Application.Index(Ar, 3)(W)
- If .Cells(E.Row, "M") = "" Then 'Range("O7:O" & yRow).Formula = "=N7*1000/L7"
- .Cells(E.Row, "O") = .Cells(E.Row, "N") * 1000 / .Cells(E.Row, "L")
- Else 'Range("O7:O" & yRow).Formula = "=M7*L7"
- .Cells(E.Row, "O") = .Cells(E.Row, "M") * .Cells(E.Row, "L")
- End If
- End If
- End If
- Next
- End With
- End Sub
½Æ»s¥N½X- Sub Ex1()
- Dim Ar(), Ay(), i As Integer, W As Variant
- With Sheets("DATA")
- Ar = .Range("B5:F" & .[B4].End(xlDown).Row).Value
- End With
- Ar = Application.WorksheetFunction.Transpose(Ar)
- With Sheets("SHEET2")
- Ay = .Range("E7:O" & .[E7].End(xlDown).Row).Value
- For i = 1 To UBound(Ay)
- W = Application.Match(Ay(i, 1), Application.Index(Ar, 1), 0)
- If IsNumeric(W) Then
- If Application.Index(Ar, 5)(W) Like "*C" Then
- Ay(i, 8) = Application.Index(Ar, 3)(W)
- If Ay(i, 9) = "" Then 'Range("O7:O" & yRow).Formula = "=N7*1000/L7"
- Ay(i, 11) = Ay(i, 10) * 1000 / Ay(i, 8)
- Else 'Range("O7:O" & yRow).Formula = "=M7*L7"
- Ay(i, 11) = Ay(i, 9) * Ay(i, 8)
- End If
- End If
- End If
- Next
- .Range("E7:O" & .[E7].End(xlDown).Row) = Ay
- End With
- End Sub
½Æ»s¥N½X |
|