안녕 모두 내가이 VBA 프로그램을 만든 무엇을하고 각 시트를 통해 가서 일부 셀과 단어를 잘 지워요 내가 시트 7까지 그것을 만든 내가 그것을 실행하는 것을 멈출 필요가있다라고하면 내가 5시에 멈추고 오류가 나기 때문에 다른 두 개를 실행하려고하지 않는 5 장만 있습니다.엑셀 Vba가 필요 중지
나는 매우 새로운 것이므로 이것에 대해 살펴보고 단축하거나 더 잘 달릴 수 있는지 확인하십시오.
Sub Step1()
' 9/20/2013
' Made by Douglas Covey
Sheets("1D_report").Select
Rows("3:9").Select
Selection.Delete Shift:=xlUp
Range("E1:F2").Select
Selection.ClearContents
Columns("H:H").Select
Selection.ClearContents
Selection.ClearContents
'
' Search and Delete.
'
Dim r As Range
Dim s As String
s = "Utilization, %"
Set r = Cells.Find(What:=s, After:=Range("A1"))
If r Is Nothing Then
MsgBox s & " could not be found" & vbCrLf & "I'am going on break"
Exit Sub
End If
Range(r, r.Offset(8, 0)).Clear
Set r = Cells.Find(What:=s, After:=Range("A1"))
If r Is Nothing Then
MsgBox s & " could not be found" & vbCrLf & "I'am going on break"
Exit Sub
End If
Range(r, r.Offset(0, 1)).Clear
s = "Total Cost:"
Set r = Cells.Find(What:=s, After:=Range("A1"))
If r Is Nothing Then
MsgBox s & " could not be found" & vbCrLf & "I'am going on break"
Exit Sub
End If
Range(r, r.Offset(0, 1)).Clear
Sheets("1D_report").Name = "Comingsoon_report"
'
' Sheet Number Two
'
Sheets("1D_1").Select
Rows("4:9").Select
Selection.Delete Shift:=xlUp
s = "Qty:"
Set r = Cells.Find(What:=s, After:=Range("A1"))
If r Is Nothing Then
MsgBox s & " could not be found" & vbCrLf & "I'am going on break"
Exit Sub
End If
Range(r, r.Offset(0, 1)).Delete Shift:=xlUp
Range("E8").Select
Cells.Find(What:="Page", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Replace What:="Page", Replacement:="Program", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
'
' Sheet Number Tree
'
Sheets("1D_2").Select
Rows("4:9").Select
Selection.Delete Shift:=xlUp
s = "Qty:"
Set r = Cells.Find(What:=s, After:=Range("A1"))
If r Is Nothing Then
MsgBox s & " could not be found" & vbCrLf & "I'am going on break"
Exit Sub
End If
Range(r, r.Offset(0, 1)).Delete Shift:=xlUp
Range("E8").Select
Cells.Find(What:="Page", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Replace What:="Page", Replacement:="Program", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
'
' Sheet Number Four
'
Sheets("1D_3").Select
Rows("4:9").Select
Selection.Delete Shift:=xlUp
s = "Qty:"
Set r = Cells.Find(What:=s, After:=Range("A1"))
If r Is Nothing Then
MsgBox s & " could not be found" & vbCrLf & "I'am going on break"
Exit Sub
End If
Range(r, r.Offset(0, 1)).Delete Shift:=xlUp
Range("E8").Select
Cells.Find(What:="Page", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Replace What:="Page", Replacement:="Program", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
'
' Sheet Number Five
'
Sheets("1D_4").Select
Rows("4:9").Select
Selection.Delete Shift:=xlUp
s = "Qty:"
Set r = Cells.Find(What:=s, After:=Range("A1"))
If r Is Nothing Then
MsgBox s & " could not be found" & vbCrLf & "I'am going on break"
Exit Sub
End If
Range(r, r.Offset(0, 1)).Delete Shift:=xlUp
Range("E8").Select
Cells.Find(What:="Page", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Replace What:="Page", Replacement:="Program", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
'
' Sheet Number Six
'
Sheets("1D_5").Select
Rows("4:9").Select
Selection.Delete Shift:=xlUp
s = "Qty:"
Set r = Cells.Find(What:=s, After:=Range("A1"))
If r Is Nothing Then
MsgBox s & " could not be found" & vbCrLf & "I'am going on break"
Exit Sub
End If
Range(r, r.Offset(0, 1)).Delete Shift:=xlUp
Range("E8").Select
Cells.Find(What:="Page", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Replace What:="Page", Replacement:="Program", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
'
' Sheet Number Seven
'
Sheets("1D_6").Select
Rows("4:9").Select
Selection.Delete Shift:=xlUp
s = "Qty:"
Set r = Cells.Find(What:=s, After:=Range("A1"))
If r Is Nothing Then
MsgBox s & " could not be found" & vbCrLf & "I'am going on break"
Exit Sub
End If
Range(r, r.Offset(0, 1)).Delete Shift:=xlUp
Range("E8").Select
Cells.Find(What:="Page", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Replace What:="Page", Replacement:="Program", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub
내가 필요한 것은 더 이상 매 다윗 Zemens 당신이 도와 줄 수 – Dmcovey1993
남아 있지있을 경우 그것을 막을 수있는 방법은? – Dmcovey1993
내 대답보기. 통합 문서를 복제하고 복제하지 않기 때문에 테스트되지 않지만 코드를보다 효율적으로 만드는 방법에 대한 좋은 아이디어를 제공합니다. –