回復 5#yen956
處理離職人員副程式
修正如下:
'處理離職人員副程式
Sub 處理離職人員(ByVal name1 As String)
Dim sh, sh1 As Worksheet
Dim r1, rowA, col1 As Integer
Dim rng As Range, str1 As String
Set sh1 = Sheets("總表")
Set sh = Sheets(name1)
' Application.ScreenUpdating = False '關閉螢幕刷新
'//////////////////////
'以下刪除 欄G、欄H... 的 離職人員名單
col1 = 7
Do
If sh.Cells(2, col1) <> "" Then
'重新定義 match 欲搜尋的範圍
ActiveWorkbook.Names("x").Delete
ActiveWorkbook.Names.Add Name:="x", RefersToR1C1:="=" & name1 & "!R2C" & col1 & ":R" & rowA & "C" & col1 & ""
If Application.IsNumber(sh1.[N8]) Then
sh.Cells(sh1.[N8], col1).Delete Shift:=xlUp
End If
End If
col1 = col1 + 1
Loop Until sh.Cells(2, col1) = ""
End If
End Sub作者: yen956 時間: 2014-4-9 19:50