copy, past, and modify macro

来源: 2005-01-28 19:42:14 [博客] [旧帖] [给我悄悄话] 本文已被阅读:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 1/28/2005 by alex
'

'
startvalue = InputBox("input start number", "Start Value")
endvalue = InputBox("input end number", "End Value")
If startvalue > endvalue Then
For i = startvalue To endvalue Step -1
Cells(2, 6).Value = i 'B6
'ActiveSheet.PageSetup.Orientation = xlLandscape
ActiveSheet.PrintOut
Next i

Else
For i = startvalue To endvalue
Cells(2, 6).Value = i
'ActiveSheet.PageSetup.Orientation = xlLandscape
ActiveSheet.PrintOut
Next i
End If


End Sub