Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I loop a cpy column,paste and print

Status
Not open for further replies.

2ks

Technical User
Jan 13, 2007
54
GB
I have ssheet that column A is a list of headings, column B is empty and Column C onwards have data that relate to the headings.

I need to copy and Paste Column C into Column B and print. Then copy Column D into B, Print and so on so forth until the loop reaches an empty column.

Can this be looped rather than manually recording a tedious vba coding. If so how?

Many thanks
 
A starting point:
For i = 3 To 256
If Application.CountA(Columns(i)) = 0 Then Exit For
Columns(i).Copy Destination:=Columns(2)
ActiveSheet.PrintOut
Next i

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
(Beforehand: At the moment I have no Excel on my machine, that's why I cannot provide the code - and I have forgotten what "Spalte ausblenden" is in English. I will use: make the column not visible.)

Wouldn't it be easier to write a macro that
- makes all columns except A and C not visible
- prints
- makes all columns except A and D not visible
- prints
and so on?

One could get the visible column with

For i = 3 to columns.count
columns(i).visible=true
next i
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top