PC Review


Reply
Thread Tools Rate Thread

Copy row from list and print

 
 
Nigel
Guest
Posts: n/a
 
      5th Apr 2008
I have a mailing list in excel with the first row being headers. I need to
copy the list one row at a time, transpose the row and paste into a new sheet
in col B which already has the headers vertically in col A. I then need to
print this page, delete the data that has just been pasted and start again
with the next row in the mailing list.
My attempt at performing this task is below (it does'nt work) can anybody
help.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 04/04/2008 by nigel
'

'
Worksheets("Mailing_List").Activate
Range("A2").Activate
Set tbl = ActiveCell.CurrentRegion
tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _
tbl.Columns.Count).Select
For Each rw In Worksheets("Mailing_List").CurrentRegion.Copy
Sheets("Directory").Range("B3").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
SkipBlanks:=False _
, Transpose:=True
ActiveSheet.PrintOut
Range("B3:B38").Clear
Next
End Sub
 
Reply With Quote
 
 
 
 
cht13er
Guest
Posts: n/a
 
      5th Apr 2008
On Apr 5, 10:19 am, Nigel <Ni...@discussions.microsoft.com> wrote:
> I have a mailing list in excel with the first row being headers. I need to
> copy the list one row at a time, transpose the row and paste into a new sheet
> in col B which already has the headers vertically in col A. I then need to
> print this page, delete the data that has just been pasted and start again
> with the next row in the mailing list.
> My attempt at performing this task is below (it does'nt work) can anybody
> help.
>
> Sub Macro1()
> '
> ' Macro1 Macro
> ' Macro recorded 04/04/2008 by nigel
> '
>
> '
> Worksheets("Mailing_List").Activate
> Range("A2").Activate
> Set tbl = ActiveCell.CurrentRegion
> tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _
> tbl.Columns.Count).Select
> For Each rw In Worksheets("Mailing_List").CurrentRegion.Copy
> Sheets("Directory").Range("B3").Select
> Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
> SkipBlanks:=False _
> , Transpose:=True
> ActiveSheet.PrintOut
> Range("B3:B38").Clear
> Next
> End Sub


See if this helps:

Public Sub doit()

'Copy
Sheets("Mailing List").Activate
Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select ' I think you
don't want this row
Selection.Copy

'Paste
Sheets("Directory").Activate
Range("B1").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
SkipBlanks:=False _
, Transpose:=True
Application.CutCopyMode = False

'Print
ActiveWorkbook.PrintOut
End Sub

You'll want to do a few things: check the cells that are being
selected, and look at the row with the comment above ... and then of
course add a loop - I'll let you figure that out for yourself? :-)

(Something like Do Until ActiveCell = ""
....'copy
....'paste
...'print
ActiveCell.Offset(1,0).Select
Loop

HTH

Chris
 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      5th Apr 2008
try this

ub Macro1()
'
' Macro1 Macro
' Macro recorded 04/04/2008 by nigel
'

'
Worksheets("Mailing_List").Activate
Range("A2").Activate
Set tbl = ActiveCell.CurrentRegion

tbl.Resize(tbl.Rows.Count, _
tbl.Columns.Count).Select

For rw = tbl.Row To tbl.End(xlDown).Row
Worksheets("Mailing_List").Rows(rw).EntireRow.Copy
With Sheets("Directory")
.Range("B3").PasteSpecial _
Paste:=xlAll, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=True
'.PrintOut
.Range("B3:B38").Clear
End With
Next
End Sub

"Nigel" wrote:

> I have a mailing list in excel with the first row being headers. I need to
> copy the list one row at a time, transpose the row and paste into a new sheet
> in col B which already has the headers vertically in col A. I then need to
> print this page, delete the data that has just been pasted and start again
> with the next row in the mailing list.
> My attempt at performing this task is below (it does'nt work) can anybody
> help.
>
> Sub Macro1()
> '
> ' Macro1 Macro
> ' Macro recorded 04/04/2008 by nigel
> '
>
> '
> Worksheets("Mailing_List").Activate
> Range("A2").Activate
> Set tbl = ActiveCell.CurrentRegion
> tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _
> tbl.Columns.Count).Select
> For Each rw In Worksheets("Mailing_List").CurrentRegion.Copy
> Sheets("Directory").Range("B3").Select
> Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
> SkipBlanks:=False _
> , Transpose:=True
> ActiveSheet.PrintOut
> Range("B3:B38").Clear
> Next
> End Sub

 
Reply With Quote
 
Nigel
Guest
Posts: n/a
 
      5th Apr 2008
Excellent, thanks Joel

"Joel" wrote:

> try this
>
> ub Macro1()
> '
> ' Macro1 Macro
> ' Macro recorded 04/04/2008 by nigel
> '
>
> '
> Worksheets("Mailing_List").Activate
> Range("A2").Activate
> Set tbl = ActiveCell.CurrentRegion
>
> tbl.Resize(tbl.Rows.Count, _
> tbl.Columns.Count).Select
>
> For rw = tbl.Row To tbl.End(xlDown).Row
> Worksheets("Mailing_List").Rows(rw).EntireRow.Copy
> With Sheets("Directory")
> .Range("B3").PasteSpecial _
> Paste:=xlAll, _
> Operation:=xlNone, _
> SkipBlanks:=False, _
> Transpose:=True
> '.PrintOut
> .Range("B3:B38").Clear
> End With
> Next
> End Sub
>
> "Nigel" wrote:
>
> > I have a mailing list in excel with the first row being headers. I need to
> > copy the list one row at a time, transpose the row and paste into a new sheet
> > in col B which already has the headers vertically in col A. I then need to
> > print this page, delete the data that has just been pasted and start again
> > with the next row in the mailing list.
> > My attempt at performing this task is below (it does'nt work) can anybody
> > help.
> >
> > Sub Macro1()
> > '
> > ' Macro1 Macro
> > ' Macro recorded 04/04/2008 by nigel
> > '
> >
> > '
> > Worksheets("Mailing_List").Activate
> > Range("A2").Activate
> > Set tbl = ActiveCell.CurrentRegion
> > tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _
> > tbl.Columns.Count).Select
> > For Each rw In Worksheets("Mailing_List").CurrentRegion.Copy
> > Sheets("Directory").Range("B3").Select
> > Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
> > SkipBlanks:=False _
> > , Transpose:=True
> > ActiveSheet.PrintOut
> > Range("B3:B38").Clear
> > Next
> > End Sub

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print BCC List on Hard Copy Karen Microsoft Outlook Discussion 3 2nd Jun 2009 12:48 AM
Print or copy the names in a distribution list? =?Utf-8?B?RXJpYw==?= Microsoft Outlook Discussion 4 15th Nov 2006 11:41 PM
how can I print out a copy of my autocomplete name list? =?Utf-8?B?U3RldmVfYXRTTVI=?= Microsoft Outlook Discussion 1 11th Aug 2005 05:20 AM
how do I print or copy a reminder list? =?Utf-8?B?VEN5cmlsbGlj?= Microsoft Outlook Discussion 0 17th Jan 2005 11:13 PM
Print/Copy list of network connections shcr Windows XP General 2 15th Jan 2004 10:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:22 AM.