#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default program

I have an small program with a bug in the second pass to print a spread
sheet, it does the fisrt time without no problems, but the second time,
doesn't work anymore.
NEED HELP..
Private Sub CommandButton1_Click()
ans = MsgBox("Do you want to print faxes?", vbYesNo)
If ans = vbNo Then
Exit Sub
End If
Dim col As Integer
Dim row As Integer
Dim counter As Integer
Dim I As Integer


col = 2
row = 2
counter = 1

For row = row To 20
If Sheet8.Cells(row, counter) = "" Then
Exit Sub
Else
Sheet1.Cells(3, 7) = Sheet8.Cells(row, counter)
counter = counter + 1
Sheet1.Cells(5, 3) = Sheet8.Cells(row, counter)
counter = counter + 1
Sheet1.Cells(5, 6) = Sheet8.Cells(row, counter)
counter = counter + 1
Sheet1.Cells(5, 9) = Sheet8.Cells(row, counter)
counter = counter + 1
Sheet1.Cells(5, 12) = Sheet8.Cells(row, counter)
counter = counter + 1
counter = 1
Sheet1.PrintOut
Sheet8.Cells(row, 5) = "PRINTED"



For I = I To 300
Next I
I = 0


End If
Next row

End Sub


Private Sub CommandButton2_Click()
Dim row1 As Integer
Dim count As Integer
row1 = 2
count = 1
For row1 = row1 To 30
For count = count To 5
Sheet8.Cells(row1, count) = ""
Next count
count = 1
Next row1
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default program

Clicking Commandbutton2 clears all the values out of Sheet8, rows 2 to 30

the first test in CommandButton1 is

If Sheet8.Cells(row, counter) = "" Then
Exit Sub
Else

so it quites on the first empty cell in Sheet8 in A2:A20

Possible that you have empty cells in column 1 of sheet8?

--
Regards,
Tom Ogilvy


"Fernando Duran" wrote:

I have an small program with a bug in the second pass to print a spread
sheet, it does the fisrt time without no problems, but the second time,
doesn't work anymore.
NEED HELP..
Private Sub CommandButton1_Click()
ans = MsgBox("Do you want to print faxes?", vbYesNo)
If ans = vbNo Then
Exit Sub
End If
Dim col As Integer
Dim row As Integer
Dim counter As Integer
Dim I As Integer


col = 2
row = 2
counter = 1

For row = row To 20
If Sheet8.Cells(row, counter) = "" Then
Exit Sub
Else
Sheet1.Cells(3, 7) = Sheet8.Cells(row, counter)
counter = counter + 1
Sheet1.Cells(5, 3) = Sheet8.Cells(row, counter)
counter = counter + 1
Sheet1.Cells(5, 6) = Sheet8.Cells(row, counter)
counter = counter + 1
Sheet1.Cells(5, 9) = Sheet8.Cells(row, counter)
counter = counter + 1
Sheet1.Cells(5, 12) = Sheet8.Cells(row, counter)
counter = counter + 1
counter = 1
Sheet1.PrintOut
Sheet8.Cells(row, 5) = "PRINTED"



For I = I To 300
Next I
I = 0


End If
Next row

End Sub


Private Sub CommandButton2_Click()
Dim row1 As Integer
Dim count As Integer
row1 = 2
count = 1
For row1 = row1 To 30
For count = count To 5
Sheet8.Cells(row1, count) = ""
Next count
count = 1
Next row1
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
Is there a way to unload the loaded XLL file in Excel? Hi all, I amdebugging XLL link library using Visual C++. Everytime I rebuild the XLL, Ihave to close the whole Excel program and relaunch the Excel program again,and then load in the newly gene LunaMoon Excel Discussion (Misc queries) 0 July 28th 08 11:03 PM
Help with Program juanpablo Excel Worksheet Functions 3 April 13th 08 10:45 PM
Which program? Dear Sir Excel Discussion (Misc queries) 4 January 14th 07 07:27 PM
merging excel program with tdc finance program judy Excel Programming 0 November 5th 03 08:01 PM
run program Van daal Excel Programming 1 September 12th 03 04:50 PM


All times are GMT +1. The time now is 11:17 AM.

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

About Us

"It's about Microsoft Excel"