ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print To WorkSheet (https://www.excelbanter.com/excel-programming/404518-print-worksheet.html)

open a adobe file from a command button

Print To WorkSheet
 
The person that wrote this code is no longer around. It works great in the
immediate window. My question is what do I do to get it to print onto a
worksheet?

Thank You

Sub bill()
'Dim varibles
Dim xx As Integer
Dim Row As Integer
Dim Unit As Integer
Dim Shelf As Integer
Dim Position As Integer
Dim Rowcounter As Integer
Dim Unitcounter As Integer
Dim Shelfcounter As Integer
Dim Positioncounter As Integer

'Set varibles starting number
Row = 1
Unit = 1
Shelf = 1
Position = 0
Rowcounter = 1
Unitcounter = 1
Shelfcounter = 1
Positioncounter = 1
xx = 0

Do While xx <= 50
xx = xx + 1
Position = Position + 1

If Position = 6 Then
Shelf = Shelf + 1
Position = 1
End If



Debug.Print " Row is " & Row & _
" Unit is " & Unit & _
" Shelf is " & Shelf & _
" Position is " & Position

Loop
End Sub


Nigel[_2_]

Print To WorkSheet
 
Replace this section ......

Debug.Print " Row is " & Row & _
" Unit is " & Unit & _
" Shelf is " & Shelf & _
" Position is " & Position

with this.........

With Sheets("Sheet1")
.Cells(xx, 1) = "Row is " & Row
.Cells(xx, 2) = "Unit is " & Unit
.Cells(xx, 3) = "Shelf is " & Shelf
.Cells(xx, 4) = "Position is " & Position
End With

--

Regards,
Nigel




"open a adobe file from a command button"
osoft.com wrote in
message ...
The person that wrote this code is no longer around. It works great in
the
immediate window. My question is what do I do to get it to print onto a
worksheet?

Thank You

Sub bill()
'Dim varibles
Dim xx As Integer
Dim Row As Integer
Dim Unit As Integer
Dim Shelf As Integer
Dim Position As Integer
Dim Rowcounter As Integer
Dim Unitcounter As Integer
Dim Shelfcounter As Integer
Dim Positioncounter As Integer

'Set varibles starting number
Row = 1
Unit = 1
Shelf = 1
Position = 0
Rowcounter = 1
Unitcounter = 1
Shelfcounter = 1
Positioncounter = 1
xx = 0

Do While xx <= 50
xx = xx + 1
Position = Position + 1

If Position = 6 Then
Shelf = Shelf + 1
Position = 1
End If



Debug.Print " Row is " & Row & _
" Unit is " & Unit & _
" Shelf is " & Shelf & _
" Position is " & Position

Loop
End Sub



open a adobe file from a command button

Print To WorkSheet
 
That Works great!
Thank You very Much!!

"Nigel" wrote:

Replace this section ......

Debug.Print " Row is " & Row & _
" Unit is " & Unit & _
" Shelf is " & Shelf & _
" Position is " & Position

with this.........

With Sheets("Sheet1")
.Cells(xx, 1) = "Row is " & Row
.Cells(xx, 2) = "Unit is " & Unit
.Cells(xx, 3) = "Shelf is " & Shelf
.Cells(xx, 4) = "Position is " & Position
End With

--

Regards,
Nigel




"open a adobe file from a command button"
osoft.com wrote in
message ...
The person that wrote this code is no longer around. It works great in
the
immediate window. My question is what do I do to get it to print onto a
worksheet?

Thank You

Sub bill()
'Dim varibles
Dim xx As Integer
Dim Row As Integer
Dim Unit As Integer
Dim Shelf As Integer
Dim Position As Integer
Dim Rowcounter As Integer
Dim Unitcounter As Integer
Dim Shelfcounter As Integer
Dim Positioncounter As Integer

'Set varibles starting number
Row = 1
Unit = 1
Shelf = 1
Position = 0
Rowcounter = 1
Unitcounter = 1
Shelfcounter = 1
Positioncounter = 1
xx = 0

Do While xx <= 50
xx = xx + 1
Position = Position + 1

If Position = 6 Then
Shelf = Shelf + 1
Position = 1
End If



Debug.Print " Row is " & Row & _
" Unit is " & Unit & _
" Shelf is " & Shelf & _
" Position is " & Position

Loop
End Sub




All times are GMT +1. The time now is 10:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com