ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro 2 (https://www.excelbanter.com/excel-discussion-misc-queries/15484-macro-2-a.html)

Esrei

Macro 2
 
Range("A2:D2").Select
Selection.Copy
Sheets("Sheet2").Select
Selection.PasteSpecial Paste:=xlAll,
Operation:=xlNone, SkipBlanks:=False _
, Transpose:=True
Sheets("Sheet1").Select
Range("A2" xlDropDown)
If Cells (row_index, "A").Value <
End Sub

I know I need a bid more experience but learning as I go.
I want to copy lines to a sheet, transposed, and print.
Then the macro must go to the next line and do this again
and stop at the last line.

Earl Kiosterud

Esrei,

Try this:

Sub PrintTransposed()
Sheets("Sheet2").Select
Sheets("Sheet2").Range("B4").Select ' set printout location
Sheets("Sheet1").Select
Range("A2:D2").Select ' first row to process
Do While ActiveCell < ""
Selection.Copy
Sheets("Sheet2").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False
_
, Transpose:=True
ActiveWindow.SelectedSheets.PrintPreview ' use for testing
'ActiveWindow.SelectedSheets.PrintOut ' use for real printing
Sheets("Sheet1").Select ' back to sheet 1
Selection.Offset(1, 0).Select ' move down ' move selection down
Loop
End Sub

It only looks at the cell in column A, and stops when it's empty. The
Printout line is "remmed out" now. When it's working correctly with the
PrintPreview, switch the apostrophe (') with the other line

I would have recommended a more meaningful subject line for this post, like
"Macro to print rows transposed."

--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Esrei" wrote in message
...
Range("A2:D2").Select
Selection.Copy
Sheets("Sheet2").Select
Selection.PasteSpecial Paste:=xlAll,
Operation:=xlNone, SkipBlanks:=False _
, Transpose:=True
Sheets("Sheet1").Select
Range("A2" xlDropDown)
If Cells (row_index, "A").Value <
End Sub

I know I need a bid more experience but learning as I go.
I want to copy lines to a sheet, transposed, and print.
Then the macro must go to the next line and do this again
and stop at the last line.





All times are GMT +1. The time now is 09:21 AM.

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