Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
bob bob is offline
external usenet poster
 
Posts: 12
Default Vb Code not working

This code only checks the first range and stops or prints. What is wrong? I would like it to continue to all 20 ranges check and skip or print.
Can you tell what is missing

Private Sub CommandButton34_Click(
Dim iRow As Lon
Dim HowMany As Lon

HowMany = 2

With ActiveShee
For iRow = 52 To (32 * HowMany - 1) + 52 Step 3
If IsNumeric(.Cells(iRow + 3, "I").Value) The
If .Cells(iRow + 3, "I").Value 0 The
.Cells(iRow, "A").Resize(16, 9).PrintPrevie
'.printout when you're done checkin
Exit Fo
End I
End I
Next iRo
End Wit

Range("A1").Selec
End Su

Thank you very much.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Vb Code not working

Remove the "exit for"

IIRC, you're original code printed the first one that matched and didn't print
anymore.

(But it's been a couple of days <bg.)

bob wrote:

This code only checks the first range and stops or prints. What is wrong? I would like it to continue to all 20 ranges check and skip or print.
Can you tell what is missing?

Private Sub CommandButton34_Click()
Dim iRow As Long
Dim HowMany As Long

HowMany = 20

With ActiveSheet
For iRow = 52 To (32 * HowMany - 1) + 52 Step 32
If IsNumeric(.Cells(iRow + 3, "I").Value) Then
If .Cells(iRow + 3, "I").Value 0 Then
.Cells(iRow, "A").Resize(16, 9).PrintPreview
'.printout when you're done checking
Exit For
End If
End If
Next iRow
End With

Range("A1").Select
End Sub

Thank you very much.


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Vb Code not working

How do I include a header to print on each page. The header is at the
top of the first sheet.

Thank you,

Bob



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Vb Code not working

One option would be to use the rows to repeat at top setting.

in page setup, on the last tab, look at the rows to repeat at top setting.

Turn on the macro recorder to see how to set it in code (set it manually
with the macro recorder turned on).

--
Regards,
Tom Ogilvy

"Bob Ciepiela" wrote in message
...
How do I include a header to print on each page. The header is at the
top of the first sheet.

Thank you,

Bob



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



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
VB Code Is Not Working Rob Excel Discussion (Misc queries) 2 May 30th 07 05:23 PM
Code not working and can't see why Steve Excel Discussion (Misc queries) 3 December 31st 04 04:12 PM
why this code not working tj Excel Programming 0 September 2nd 03 07:14 PM
why this code not working Bernie Deitrick[_2_] Excel Programming 0 September 2nd 03 05:08 PM
For Each Code Not Working jacqui[_2_] Excel Programming 4 July 29th 03 02:44 AM


All times are GMT +1. The time now is 10:42 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"