snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Hi Dear,
I got this code from my friend.
Those code is use print from selected any range in a sheet thru inputbox but it is no luck.
Sub PrintIt()
Dim rRange As Range
Set rRange=Application.InputBox("Please select the range",Type:=8)
With Sheets(Application.InputBox("Input Sheet Name"))
.PageSetup.PrintArea=rRange.Address
.PrintOut Copies:=Inputbox("Number of copies:"), Collate:=True
End With
End Sub
Sub PrintIt()
Dim rRange As Range
Set rRange=Application.InputBox("Please select the range",Type:=8)
With Sheets(Application.InputBox("Input Sheet Name"))
.PageSetup.PrintArea=rRange.Address
.PrintOut Copies:=Inputbox("Number of copies:"), Collate:=True
End With
End Sub
I have tested this code and it worked properly not show any problem.