D
Don....confused again??
Hi All,
Below is the code...this thing hangs every other time I
run it. And hangs on the same line. Can anyone tell me
what's making it do that, please? I know I'm using a lot
of Dim statements but just trying to practice with them.
I've shown the line where it hangs with *** on both sides
of it:
Dim rRge3 As Range
Dim rRge4 As Range
Dim rRge5 As Range
Dim rRge6 As Range
Dim rRge7 As Range
Dim rRge8 As Range
Dim rRge9 As Range
Set rRge3 = Sheets("Data").Range("A4:FF500")
Set rRge4 = Sheets("Data").Range("A4")
Set rRge5 = Sheets("Upgrade Invoice").Range("A1:K49")
Set rRge6 = Sheets("Upgrade Invoice (2)").Range
("A1:K49")
Set rRge7 = Sheets("Upgrade Invoice (2)").Range
("B7:K46")
Set rRge8 = Sheets("Upgrade Invoice (2)").Range("B7")
Set rRge9 = Sheets("Upgrade Invoice (2)").Range("A1")
With Sheets("Data")
.Select
.Unprotect
rRge3.Select
Selection.Sort Key1:=Range("BA4"),
Order1:=xlDescending, HEADER:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
rRge4.Select
.Protect
End With
With Sheets("Upgrade Invoice")
.Select
.Unprotect
rRge5.Select
Selection.Copy
End With
With Sheets("Upgrade Invoice (2)")
.Select
.Unprotect
rRge9.Select
*** .Paste ****
rRge6.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
rRge7.Select
Selection.Sort Key1:=Range("H7"),
Order1:=xlAscending, HEADER:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
rRge8.Select
.Protect
.Copy
End With
Range("B7").Select
ActiveSheet.Protect DrawingObjects:=True,
Contents:=True, Scenarios:=True
' ActiveWorkbook.Protect Structure:=True, Windows:=False
ActiveWorkbook.SaveAs
Filename:="C:\WirelessLedger\Upgrade Invoices\" _
& Format(Date, "mm-dd-yy") & " Upgrade Inv" & ".xls", _
FileFormat:=xlNormal, Password:="",
WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True
Range("H1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False,
AddHistory:=True
Range("B7").Select
ActiveSheet.Protect
ActiveWindow.Close
With Sheets("Upgrade Invoice (2)")
.Unprotect
rRge6.Select
Selection.Clear
rRge9.Select
.Protect
End With
Any help here would be greatly appreciated,
TIA,
Don
Below is the code...this thing hangs every other time I
run it. And hangs on the same line. Can anyone tell me
what's making it do that, please? I know I'm using a lot
of Dim statements but just trying to practice with them.
I've shown the line where it hangs with *** on both sides
of it:
Dim rRge3 As Range
Dim rRge4 As Range
Dim rRge5 As Range
Dim rRge6 As Range
Dim rRge7 As Range
Dim rRge8 As Range
Dim rRge9 As Range
Set rRge3 = Sheets("Data").Range("A4:FF500")
Set rRge4 = Sheets("Data").Range("A4")
Set rRge5 = Sheets("Upgrade Invoice").Range("A1:K49")
Set rRge6 = Sheets("Upgrade Invoice (2)").Range
("A1:K49")
Set rRge7 = Sheets("Upgrade Invoice (2)").Range
("B7:K46")
Set rRge8 = Sheets("Upgrade Invoice (2)").Range("B7")
Set rRge9 = Sheets("Upgrade Invoice (2)").Range("A1")
With Sheets("Data")
.Select
.Unprotect
rRge3.Select
Selection.Sort Key1:=Range("BA4"),
Order1:=xlDescending, HEADER:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
rRge4.Select
.Protect
End With
With Sheets("Upgrade Invoice")
.Select
.Unprotect
rRge5.Select
Selection.Copy
End With
With Sheets("Upgrade Invoice (2)")
.Select
.Unprotect
rRge9.Select
*** .Paste ****
rRge6.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
rRge7.Select
Selection.Sort Key1:=Range("H7"),
Order1:=xlAscending, HEADER:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
rRge8.Select
.Protect
.Copy
End With
Range("B7").Select
ActiveSheet.Protect DrawingObjects:=True,
Contents:=True, Scenarios:=True
' ActiveWorkbook.Protect Structure:=True, Windows:=False
ActiveWorkbook.SaveAs
Filename:="C:\WirelessLedger\Upgrade Invoices\" _
& Format(Date, "mm-dd-yy") & " Upgrade Inv" & ".xls", _
FileFormat:=xlNormal, Password:="",
WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True
Range("H1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False,
AddHistory:=True
Range("B7").Select
ActiveSheet.Protect
ActiveWindow.Close
With Sheets("Upgrade Invoice (2)")
.Unprotect
rRge6.Select
Selection.Clear
rRge9.Select
.Protect
End With
Any help here would be greatly appreciated,
TIA,
Don