Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default help reducing lines of code

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)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default help reducing lines of code

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)



  #3   Report Post  
Posted to microsoft.public.excel.programming
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)



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default help reducing lines of code

glad to help.

"Robert Christie" wrote in message
...
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)



.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
code to fill in missing border lines Jack Sons Excel Discussion (Misc queries) 3 November 3rd 05 10:06 PM
how do i comment 1000 lines of code at once in vba for excel? Anne Troy Excel Worksheet Functions 1 July 7th 05 01:39 AM
Code for Inserting Multiple lines Frantic Excel-er Excel Discussion (Misc queries) 0 June 17th 05 06:36 PM
Excel skip some lines of VBA code Alex[_7_] Excel Programming 1 August 28th 03 12:18 PM
Code Text Into Chart Lines? Phil Hageman Excel Programming 3 July 17th 03 11:51 AM


All times are GMT +1. The time now is 02:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"