Loop problem, I think

G

Guest

I have the following code but does not seem to work. It seem that I'm missing
something, but being a noves, I'm not sure what it is. I need to increase the
value in cell B12 by 1. Thanks

Sub printall()
'
' Keyboard Shortcut: Ctrl+t
'
Do Until B12 = 5
[B12].Value = [B12] + 1
Sheets(Array("Title", "Rules", "G - First Arrival")).Select
Sheets("Title").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("INPUT").Select
Loop
End Sub
 
G

Guest

Try this approach, assuming that you always need to count to 5. Declare an
integer variable (in this example 'i') and use a For loop to count off the
loop until the number 5 is reached.

************************************************

Dim i as Integer

for i = 1 to 5
[B12].Value = [B12] + 1
Sheets(Array("Title", "Rules", "G - First Arrival")).Select
Sheets("Title").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("INPUT").Select
Next i
************************************************
 
Joined
Aug 30, 2007
Messages
18
Reaction score
0
if you are trying o increase the value in cell B12 then try:

Code:
Range("B12").Value = Range("B12").Value + 1
 
G

Guest

Great, thanks. Worked like a charm.

Is there a way to print to Adobe and then save the Adobe file using todays
date and the file number?
Or am I asking to much?

Dim i as Integer

for i = 1 to 5
[B12].Value = [B12] + 1
Sheets(Array("Title", "Rules", "G - First Arrival")).Select
Sheets("Title").Activate
Application.ActivePrinter = "Adobe PDF on Ne00:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF on Ne00:", Collate:=True
Sheets("INPUT").Select
Next i

Kevin B said:
Try this approach, assuming that you always need to count to 5. Declare an
integer variable (in this example 'i') and use a For loop to count off the
loop until the number 5 is reached.

************************************************

Dim i as Integer

for i = 1 to 5
[B12].Value = [B12] + 1
Sheets(Array("Title", "Rules", "G - First Arrival")).Select
Sheets("Title").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("INPUT").Select
Next i
************************************************
--
Kevin Backmann


pgarcia said:
I have the following code but does not seem to work. It seem that I'm missing
something, but being a noves, I'm not sure what it is. I need to increase the
value in cell B12 by 1. Thanks

Sub printall()
'
' Keyboard Shortcut: Ctrl+t
'
Do Until B12 = 5
[B12].Value = [B12] + 1
Sheets(Array("Title", "Rules", "G - First Arrival")).Select
Sheets("Title").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("INPUT").Select
Loop
End Sub
 
G

Guest

Wish I could help you with the Adobe question but I've not had much exposure
to Adobe file formats other than reading PDF files. Are you working in
Office 2007? My understanding that you can do PDF conversions in that
release of Office
--
Kevin Backmann


pgarcia said:
Great, thanks. Worked like a charm.

Is there a way to print to Adobe and then save the Adobe file using todays
date and the file number?
Or am I asking to much?

Dim i as Integer

for i = 1 to 5
[B12].Value = [B12] + 1
Sheets(Array("Title", "Rules", "G - First Arrival")).Select
Sheets("Title").Activate
Application.ActivePrinter = "Adobe PDF on Ne00:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF on Ne00:", Collate:=True
Sheets("INPUT").Select
Next i

Kevin B said:
Try this approach, assuming that you always need to count to 5. Declare an
integer variable (in this example 'i') and use a For loop to count off the
loop until the number 5 is reached.

************************************************

Dim i as Integer

for i = 1 to 5
[B12].Value = [B12] + 1
Sheets(Array("Title", "Rules", "G - First Arrival")).Select
Sheets("Title").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("INPUT").Select
Next i
************************************************
--
Kevin Backmann


pgarcia said:
I have the following code but does not seem to work. It seem that I'm missing
something, but being a noves, I'm not sure what it is. I need to increase the
value in cell B12 by 1. Thanks

Sub printall()
'
' Keyboard Shortcut: Ctrl+t
'
Do Until B12 = 5
[B12].Value = [B12] + 1
Sheets(Array("Title", "Rules", "G - First Arrival")).Select
Sheets("Title").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("INPUT").Select
Loop
End Sub
 
G

Guest

No, in 2000. But thanks any ways. I may have to find some other way. Can I
bring up a command prompt and run a scrip from Excell?

Kevin B said:
Wish I could help you with the Adobe question but I've not had much exposure
to Adobe file formats other than reading PDF files. Are you working in
Office 2007? My understanding that you can do PDF conversions in that
release of Office
--
Kevin Backmann


pgarcia said:
Great, thanks. Worked like a charm.

Is there a way to print to Adobe and then save the Adobe file using todays
date and the file number?
Or am I asking to much?

Dim i as Integer

for i = 1 to 5
[B12].Value = [B12] + 1
Sheets(Array("Title", "Rules", "G - First Arrival")).Select
Sheets("Title").Activate
Application.ActivePrinter = "Adobe PDF on Ne00:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF on Ne00:", Collate:=True
Sheets("INPUT").Select
Next i

Kevin B said:
Try this approach, assuming that you always need to count to 5. Declare an
integer variable (in this example 'i') and use a For loop to count off the
loop until the number 5 is reached.

************************************************

Dim i as Integer

for i = 1 to 5
[B12].Value = [B12] + 1
Sheets(Array("Title", "Rules", "G - First Arrival")).Select
Sheets("Title").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("INPUT").Select
Next i
************************************************
--
Kevin Backmann


:

I have the following code but does not seem to work. It seem that I'm missing
something, but being a noves, I'm not sure what it is. I need to increase the
value in cell B12 by 1. Thanks

Sub printall()
'
' Keyboard Shortcut: Ctrl+t
'
Do Until B12 = 5
[B12].Value = [B12] + 1
Sheets(Array("Title", "Rules", "G - First Arrival")).Select
Sheets("Title").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("INPUT").Select
Loop
End Sub
 
G

Guest

Go to VBE and look up the SHELL Function. This would let you run an external
exe
--
Kevin Backmann


pgarcia said:
No, in 2000. But thanks any ways. I may have to find some other way. Can I
bring up a command prompt and run a scrip from Excell?

Kevin B said:
Wish I could help you with the Adobe question but I've not had much exposure
to Adobe file formats other than reading PDF files. Are you working in
Office 2007? My understanding that you can do PDF conversions in that
release of Office
--
Kevin Backmann


pgarcia said:
Great, thanks. Worked like a charm.

Is there a way to print to Adobe and then save the Adobe file using todays
date and the file number?
Or am I asking to much?

Dim i as Integer

for i = 1 to 5
[B12].Value = [B12] + 1
Sheets(Array("Title", "Rules", "G - First Arrival")).Select
Sheets("Title").Activate
Application.ActivePrinter = "Adobe PDF on Ne00:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF on Ne00:", Collate:=True
Sheets("INPUT").Select
Next i

:

Try this approach, assuming that you always need to count to 5. Declare an
integer variable (in this example 'i') and use a For loop to count off the
loop until the number 5 is reached.

************************************************

Dim i as Integer

for i = 1 to 5
[B12].Value = [B12] + 1
Sheets(Array("Title", "Rules", "G - First Arrival")).Select
Sheets("Title").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("INPUT").Select
Next i
************************************************
--
Kevin Backmann


:

I have the following code but does not seem to work. It seem that I'm missing
something, but being a noves, I'm not sure what it is. I need to increase the
value in cell B12 by 1. Thanks

Sub printall()
'
' Keyboard Shortcut: Ctrl+t
'
Do Until B12 = 5
[B12].Value = [B12] + 1
Sheets(Array("Title", "Rules", "G - First Arrival")).Select
Sheets("Title").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("INPUT").Select
Loop
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Page break macro based on cell content / formula 3
Do until problem 1
conso macro 0
VB Msgbox result 1
Printing Macro 4
Print Macro Problem 4
Loop error 5
odd issue with a loop 3

Top