Loop problem, I think

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
************************************************
 
if you are trying o increase the value in cell B12 then try:

Code:
Range("B12").Value = Range("B12").Value + 1
 
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
 
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
 
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
 
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
 
Back
Top