This example repeats the most recent user interface commands. This example must be placed on the first line of the macro.
Application.repeat
In the following example, the variable counter replaces the line number. This procedure loops through the cell range C1:C20, setting the number of all absolute values less than 0.01 to 0 (0).
Sub RoundToZero1()
For Counter = 1 To 20
Set curCell = Worksheets("Sheet1").Cells(Counter, 3)
If Abs(curCell.Value) 0 Then
'
Application.ActivePrinter = "\\zdserver2\HP LaserJet 5000 PCL 6
In Ne00: "' Specify printer
ActiveWindow.SelectedSheets.PrintOut Copies:=myprintnum,
Collate:=true ' Set printing information, where Copies:=myprint is the number of copies printed
Else
MsgBox "Please enter the number of copies to print"
End If
Activesheet.showalldata ' Show All
ActiveSheet.Protect password:=641112 ' Protect worksheet and set password
Sheets ("Cover page"). Select
application.screenupdating = True
End Sub
Sub Print balance ()
application.screenupdating = False
Sheets ("balance sheet"). Select
Call to reset All tables
ActiveSheet.Unprotect password:=641112 ' Undo Worksheet protection and remove password
Activewindow.scrollcolumn = 10
Selection.autofilter field:=1, criteria1:= ""
' The following 10 rows pop-up window input print information
Dim Myprintnum as Integer
Dim myprompt, MyTitle as String
Myprompt = "Please enter the number of copies to print"
MyTitle = "Print Selection range"
Myprintnum = Application.inputbox (Myprompt, MyTitle, 4,,,,, 1)
If Myprintnum 0 Then
' Application.ActivePrinter = ' \\zdserver2\HP LaserJet 5000 PCL 6 in
Ne00: "' Specifies the printer
ActiveWindow.SelectedSheets.PrintOut Copies:=myprintnum,
Collate:=true ' Set printing information, where Copies:=myprint is the number of copies printed
Else
MsgBox "Please enter the number of copies to print"
End If
Activesheet.showalldata ' Show All
ActiveSheet.Protect password:=641112 ' Protect worksheet and set password
Sheets ("Cover page"). Select
application.screenupdating = True
End Sub
Sub Backup ()