View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Robert Christie Robert Christie is offline
external usenet poster
 
Posts: 5
Default help reducing lines of code

Hi Don
Thankyou very much for the quick reply.
The destination:=Range is a new one to me.
It worked like a charm.

Thankyou again
Bob Christie

-----Original Message-----
Range("A60:A117").Cut destination:=Range("C2")
Range("A60:A117").Delete shift:=xlUp
Range("A118:A175").Cut destination:=Range("C60")
Range("A118:A175").Delete shift:=xlUp


"Robert Christie" wrote in

message
...
Hi
Using Windows Xp & XL2002

I require advice cleaning up part of my code printed
below.
I should add, the code is working ok.

The code converts a single column of text 7 or 8 pages
long to 3 to 4 pages
of double columns of text. ( for printing only ).
The two columns of text always fit across the page

width
.
The code cuts & copies the text from page 2 Column A &

to
Column C on page 1.
The space left on page 2 Column A is deleted moving

page
3 text up, to become
the start of page 2. The code starts it's cut & paste
again until 4 pages remain.

Range("A60:A117").Cut
Range("C2").Select
ActiveSheet.Paste
Range("A60:A117").Delete shift:=xlUp
Range("A118:A175").Cut
Range("C60").Select
ActiveSheet.Paste
Range("A118:A175").Delete shift:=xlUp

I would like to reduce the codes length, doing away

with
the Select part &
combining some lines into one line..

Can the "Range("A60:A117").Cut" line be altered to
include the "Delete shift=xlup".
Can the Range("C2").Select line &

the "ActiveSheet.Paste"
line be combined.

The code started out as a recorded macro, which I have
modified to reduce the
number of Activates & Selects but can not progress any
further.
The code does not start with any Dim statements or
declarations etc.

TIA

Bob Christie (still on the steep learning curve)



.