Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default How do I "if statement"



How do I add this line of code

if c < 100 the goto next counter


Here id my code

Sub doprint()
'
' doprint Macro
' Macro recorded 9/25/2003 by AvilaJ

Dim i As Integer
Dim oCell As Range
Dim cCell As Range
Dim p As Long

strjobnumber = InputBox("Start in Job Number?", " First Job to
Print", 0)
endjobnumber = InputBox("Finish in Job Number?", " Last Job to
Print", 0)

Range("I40").Select
Range("I41").Select


For counter = strjobnumber To endjobnumber
Application.ScreenUpdating = False
Sheets("Pieces").Activate
Range("L5").Value = counter
Range("J85").Select
c = ActiveCell.Value
If c < 100 Then
Next counter
End If
Range("J80").Select
p = ActiveCell.Value
Sheets(Array("BatchSheet1", "BatchSheet2", "BatchSheet3",
"BatchSheet4", _
"BatchSheet5", "BatchSheet6", "BatchSheet7", "BatchSheet8",
"BatchSheet9", _
"BatchSheet10", "BatchSheet11", "BatchSheet12",
"BatchSheet13", "BatchSheet14", _
"BatchSheet15", "BatchSheet16", "BatchSheet17",
"BatchSheet18", "BatchSheet19", _
"BatchSheet20")).Select
Sheets("BatchSheet1").Activate
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=p,
Copies:=1, Collate _
:=True
Application.ScreenUpdating = True
Next counter
Sheets("Pieces").Activate
Range("$A$1").Select

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default How do I "if statement"

you could try

if c < 100 then c = c +1


--


Gary Keramidas


"Little Penny" wrote in message
...


How do I add this line of code

if c < 100 the goto next counter


Here id my code

Sub doprint()
'
' doprint Macro
' Macro recorded 9/25/2003 by AvilaJ

Dim i As Integer
Dim oCell As Range
Dim cCell As Range
Dim p As Long

strjobnumber = InputBox("Start in Job Number?", " First Job to
Print", 0)
endjobnumber = InputBox("Finish in Job Number?", " Last Job to
Print", 0)

Range("I40").Select
Range("I41").Select


For counter = strjobnumber To endjobnumber
Application.ScreenUpdating = False
Sheets("Pieces").Activate
Range("L5").Value = counter
Range("J85").Select
c = ActiveCell.Value
If c < 100 Then
Next counter
End If
Range("J80").Select
p = ActiveCell.Value
Sheets(Array("BatchSheet1", "BatchSheet2", "BatchSheet3",
"BatchSheet4", _
"BatchSheet5", "BatchSheet6", "BatchSheet7", "BatchSheet8",
"BatchSheet9", _
"BatchSheet10", "BatchSheet11", "BatchSheet12",
"BatchSheet13", "BatchSheet14", _
"BatchSheet15", "BatchSheet16", "BatchSheet17",
"BatchSheet18", "BatchSheet19", _
"BatchSheet20")).Select
Sheets("BatchSheet1").Activate
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=p,
Copies:=1, Collate _
:=True
Application.ScreenUpdating = True
Next counter
Sheets("Pieces").Activate
Range("$A$1").Select

End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default How do I "if statement"

think i missed your meaning

If c < 100 Then
goto NxtCntr

...
..
..
Copies:=1, Collate _
:=True
Application.ScreenUpdating = True
NxtCtr:
Next counter

--


Gary Keramidas


"Little Penny" wrote in message
...


How do I add this line of code

if c < 100 the goto next counter


Here id my code

Sub doprint()
'
' doprint Macro
' Macro recorded 9/25/2003 by AvilaJ

Dim i As Integer
Dim oCell As Range
Dim cCell As Range
Dim p As Long

strjobnumber = InputBox("Start in Job Number?", " First Job to
Print", 0)
endjobnumber = InputBox("Finish in Job Number?", " Last Job to
Print", 0)

Range("I40").Select
Range("I41").Select


For counter = strjobnumber To endjobnumber
Application.ScreenUpdating = False
Sheets("Pieces").Activate
Range("L5").Value = counter
Range("J85").Select
c = ActiveCell.Value
If c < 100 Then
Next counter
End If
Range("J80").Select
p = ActiveCell.Value
Sheets(Array("BatchSheet1", "BatchSheet2", "BatchSheet3",
"BatchSheet4", _
"BatchSheet5", "BatchSheet6", "BatchSheet7", "BatchSheet8",
"BatchSheet9", _
"BatchSheet10", "BatchSheet11", "BatchSheet12",
"BatchSheet13", "BatchSheet14", _
"BatchSheet15", "BatchSheet16", "BatchSheet17",
"BatchSheet18", "BatchSheet19", _
"BatchSheet20")).Select
Sheets("BatchSheet1").Activate
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=p,
Copies:=1, Collate _
:=True
Application.ScreenUpdating = True
Next counter
Sheets("Pieces").Activate
Range("$A$1").Select

End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default How do I "if statement"

change If c < 100 Then Next Counter
to:
-------------------------------------------------
If c < 100 Then goto NextCounter
------------------------------------------------

and the at your Next Counter
make it:
--------------------
NextCounter:
----------------------------
(note the : at the end )

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default How do I "if statement"



oops sorry ignore this my mis read..........



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default How do I "if statement"

Thanks everyone that worked...............







On Fri, 25 Aug 2006 18:03:42 -0400, Little Penny
wrote:



How do I add this line of code

if c < 100 the goto next counter


Here id my code

Sub doprint()
'
' doprint Macro
' Macro recorded 9/25/2003 by AvilaJ

Dim i As Integer
Dim oCell As Range
Dim cCell As Range
Dim p As Long

strjobnumber = InputBox("Start in Job Number?", " First Job to
Print", 0)
endjobnumber = InputBox("Finish in Job Number?", " Last Job to
Print", 0)

Range("I40").Select
Range("I41").Select


For counter = strjobnumber To endjobnumber
Application.ScreenUpdating = False
Sheets("Pieces").Activate
Range("L5").Value = counter
Range("J85").Select
c = ActiveCell.Value
If c < 100 Then
Next counter
End If
Range("J80").Select
p = ActiveCell.Value
Sheets(Array("BatchSheet1", "BatchSheet2", "BatchSheet3",
"BatchSheet4", _
"BatchSheet5", "BatchSheet6", "BatchSheet7", "BatchSheet8",
"BatchSheet9", _
"BatchSheet10", "BatchSheet11", "BatchSheet12",
"BatchSheet13", "BatchSheet14", _
"BatchSheet15", "BatchSheet16", "BatchSheet17",
"BatchSheet18", "BatchSheet19", _
"BatchSheet20")).Select
Sheets("BatchSheet1").Activate
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=p,
Copies:=1, Collate _
:=True
Application.ScreenUpdating = True
Next counter
Sheets("Pieces").Activate
Range("$A$1").Select

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
embedding "ISERROR" function into an "IF" statement [email protected] Excel Worksheet Functions 8 January 4th 07 12:01 AM
Call a sub statement in "Personal Macro Workbook" from "ThisWorkbo QC Coug Excel Programming 1 August 26th 05 07:09 PM
vba: How do I write a "For Each Statement" nested in a "With Statement"? Mcasteel[_32_] Excel Programming 0 November 8th 04 10:04 PM


All times are GMT +1. The time now is 07:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"