- ©«¤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
        
|
¦^´_ 44# 198188
¸Õ¸Õ¬Ý- '6¡^
- Sub Request()
- Dim rngSrc As Range, rngCopyField As Range, rngFilter As Range
- Dim nextRow As Long, endRow As Long
- Dim LastRec As Integer
- Dim i As Integer
- Dim The_day As String '<- ****
- Sheets("Request").[A2:AG65536].ClearContents
- Set rngSrc = Sheets("State").[A1:AG65536]
- Set rngCopyField = Sheets("Rule").[B21:AH21]
- Set rngFilter = Sheets("Rule").[B14].Resize(Sheets("Rule").[B14].CurrentRegion.Rows.Count, 33)
- nextRow = 2
- Sheets("Request").UsedRange.Offset(1).Clear
- rngSrc.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
- rngFilter, CopyToRange:=Sheets("Request").Range("A" & nextRow)
- endRow = Sheets("Request").Range("A" & Sheets("Request").Rows.Count).End(xlUp)
- For i = 1 To rngCopyField.Count
- If rngCopyField(i) = "N" Then
- Sheets("Request").Range(nextRow & ":" & endRow).Columns(i).Clear
- End If
- Next
- Sheets("Request").Range("A" & nextRow).Resize(1, 33).Delete Shift:=xlUp 'delete header
- Set rngSrc = Nothing
- Set rngCopyField = Nothing
- Set rngFilter = Nothing
- With Worksheets("Request")
- LastRec = .Range("A1").End(xlDown).Row
- For i = 2 To LastRec
- .Range("B" & i).Value = Application.VLookup(.Range("A" & i).Value, Sheets("State").Range("A:S"), 19, False)
- .Range("C" & i).Value = Application.VLookup(.Range("A" & i).Value, Sheets("State").Range("A:AA"), 27, False)
- .Range("D" & i).Value = Application.VLookup(.Range("A" & i).Value, Sheets("State").Range("A:U"), 21, False) & " - " & Application.VLookup(.Range("A" & i).Value, Sheets("State").Range("A:AC"), 29, False)
- .Range("E" & i).Value = Application.VLookup(.Range("A" & i).Value, Sheets("State").Range("A:AB"), 28, False)
- .Range("F" & i).Value = Application.VLookup(.Range("A" & i).Value, Sheets("State").Range("A:B"), 2, False)
- .Range("G" & i).Value = Application.VLookup(.Range("A" & i).Value, Sheets("State").Range("A:N"), 14, False)
- The_day = Format(Worksheets("Request").Range("F" & i).Value - 2, "AAA") '¶Ç¦^¬P´Á?
- If The_day = "¬P´Á¤»" Or The_day = "¬P´Á¤é" Then
- .Range("H" & i).Value = .Range("F" & i).Value
- Else
- .Range("H" & i).Text = .Range("F" & i).Value - 2
- End If
- .Range("F" & i).NumberFormatLocal = "m/d;@" '³]©w¤é´Á®æ¦¡
- .Range("H" & i).NumberFormatLocal = "m/d;@" '³]©w¤é´Á®æ¦¡
- Next
- End With
- End Sub
½Æ»s¥N½X |
|