我有一個工作表,其中第2行是隱藏的。一個宏粘貼到這一行。每當我運行這個宏時,隱藏的行會重新出現。運行宏後隱藏行「unhides」
有沒有辦法阻止行再次出現?
這是我的代碼它仍然是取消隱藏行2
子Update2029()
Dim LSearchRow As Integer
Dim LCopyToRow As Integer
Dim LSearchValue As String
On Error GoTo Err_Execute
Application.ScreenUpdating = False
LSearchValue = InputBox("Please enter a serial number to search for.", "Enter value")
'Start search in row 5
LSearchRow = 5
'Start copying data to row 2 in "Master" (row counter variable)
LCopyToRow = 2
While Len(Range("A" & CStr(LSearchRow)).Value) > 0
'If value in column A = LSearchValue, copy entire row to "Master"
If Range("A" & CStr(LSearchRow)).Value = LSearchValue Then
'Select row in "Master" to copy
Rows(CStr(LSearchRow) & ":" & CStr(LSearchRow)).Select
Selection.Copy
'Paste row into "Master" in row 2
Sheets("Master").Select
Rows(CStr(LCopyToRow) & ":" & CStr(LCopyToRow)).Select
ActiveSheet.PasteSpecial
End If
LSearchRow = LSearchRow + 1
Wend
'Position on cell A3
Application.CutCopyMode = False
Range("A3").Select
MsgBox "All matching data has been copied to 2029."
Exit Sub
Err_Execute: 「出現錯誤」 MSGBOX 。 表( 「主」)行( 「2:2」)。EntireRowHidden =真 ApplicationScreenUpdating =真
End Sub
謝謝你的幫助我會在星期一回去工作時嘗試。 – user1551203 2012-07-27 14:59:11