Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Business Applications Business Applications
Search Search
Search for:
Tech Support Guy > > >

Solved: Excel User Input Boxes


(!)

downhillsheep's Avatar
downhillsheep downhillsheep is offline
Member with 2 posts.
THREAD STARTER
 
Join Date: Apr 2012
Experience: Beginner
25-Apr-2012, 09:22 AM #1
Solved: Excel User Input Boxes
I have this macro that prints records based on a range that the user specifies. The only problem is that I'm still (trying to!) learning and would like to know how the code can be written so that the input box with ".....Starting Record" appears before and not after the input box ".......End Record" which is what is happening at the moment.

VB:
Sub Print_All()
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim x As Variant
Dim v As Variant
v = InputBox("Please enter the Ending Record number")
For i = InputBox("Please enter the Starting Record number") To v
x = i
Range("n2").FormulaR1C1 = x
Sheets("Deskingsheet").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False

Next i
End Sub

Thanks in advance

Lee
Ziggy1's Avatar
Computer Specs
Member with 2,525 posts.
 
Join Date: Jun 2002
Location: Ontario,Canada
Experience: Advanced
25-Apr-2012, 01:04 PM #2
this is what I would do...


VB:
Code:
Sub Print_All() 
Application.Calculation = xlCalculationAutomatic 
Application.ScreenUpdating = False 
Application.DisplayAlerts = False 
Dim x As Variant 
Dim v As Variant 

i = InputBox("Please enter the Starting Record number") 
v = InputBox("Please enter the Ending Record number") 
x = i 
For i =x To v 

Range("n2").FormulaR1C1 = x 
Sheets("Deskingsheet").Select 
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _ 
IgnorePrintAreas:=False 

x= x +1
Next i 
End Sub
downhillsheep's Avatar
downhillsheep downhillsheep is offline
Member with 2 posts.
THREAD STARTER
 
Join Date: Apr 2012
Experience: Beginner
26-Apr-2012, 06:10 AM #3
Hi Ziggy, many thanks for your help, it worked a treat
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑