PC Review


Reply
Thread Tools Rate Thread

Deleting extra rows

 
 
pringle.sergio@gmail.com
Guest
Posts: n/a
 
      14th Feb 2007
Hi,

I created a macro that copies a set of data into a template.

Since the data vary in size, I had to make full column ranges so I
would always cover the cells with data. I also recorded a macro that
creates a formula based on two of those columns then copy/pastes the
formula down to the end of the spreadsheet (eg cell D65536).

After I run the macro to copy the data into the template and perform
the necessary calculations, how can I delete the remaining rows so all
I have are blank cells under the last row of data on my template.

Range("EXP_LF").Select
Selection.Copy
Sheets("Sheet8").Select
Range("N2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("O2").Select
ActiveCell.FormulaR1C1 = "=RC[-3]-RC[-7]"
Range("O2").Select
Selection.Copy
Range("O3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone,
_
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

Thank you

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFydGluIEZpc2hsb2Nr?=
Guest
Posts: n/a
 
      14th Feb 2007
Hi,

Instead of filling down and then delete try this

Range(Range("N2").End(xlDown).Offset(0, 1), Range("O2")).FillDown

You can also refine the macro a little:

Range("EXP_LF").Select
Selection.Copy
Sheets("Sheet8").Select
Range("N2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("O2").FormulaR1C1 = "=RC[-3]-RC[-7]"
Range(Range("N2").End(xlDown).Offset(0, 1), Range("O2")).FillDown
Application.CutCopyMode = False

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"(E-Mail Removed)" wrote:

> Hi,
>
> I created a macro that copies a set of data into a template.
>
> Since the data vary in size, I had to make full column ranges so I
> would always cover the cells with data. I also recorded a macro that
> creates a formula based on two of those columns then copy/pastes the
> formula down to the end of the spreadsheet (eg cell D65536).
>
> After I run the macro to copy the data into the template and perform
> the necessary calculations, how can I delete the remaining rows so all
> I have are blank cells under the last row of data on my template.
>
> Range("EXP_LF").Select
> Selection.Copy
> Sheets("Sheet8").Select
> Range("N2").Select
> ActiveSheet.Paste
> Application.CutCopyMode = False
> Range("O2").Select
> ActiveCell.FormulaR1C1 = "=RC[-3]-RC[-7]"
> Range("O2").Select
> Selection.Copy
> Range("O3").Select
> Range(Selection, Selection.End(xlDown)).Select
> Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone,
> _
> SkipBlanks:=False, Transpose:=False
> Application.CutCopyMode = False
>
> Thank you
>
>

 
Reply With Quote
 
pringle.sergio@gmail.com
Guest
Posts: n/a
 
      14th Feb 2007
Thank you very much. This is what I needed to do in the first place.

The other problem I have is that in order to copy the entire ranges
without leaving any data behind, I created (defined) ranges from A2 to
A65536, and B2 to A65536 and so on.

Once I export my data to Excel, and run the macro, is there a way to
only select the cells that have data in them? or do I have to do this
to prevent leaving something behind?

 
Reply With Quote
 
=?Utf-8?B?TWFydGluIEZpc2hsb2Nr?=
Guest
Posts: n/a
 
      14th Feb 2007
Why not sort the data to remove the blank lines.

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"(E-Mail Removed)" wrote:

> Thank you very much. This is what I needed to do in the first place.
>
> The other problem I have is that in order to copy the entire ranges
> without leaving any data behind, I created (defined) ranges from A2 to
> A65536, and B2 to A65536 and so on.
>
> Once I export my data to Excel, and run the macro, is there a way to
> only select the cells that have data in them? or do I have to do this
> to prevent leaving something behind?
>
>

 
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
Deleting extra rows in Excel 07 Nat Microsoft Excel Misc 2 25th Jun 2009 09:30 PM
Deleting Extra Page gyf Microsoft Excel Misc 2 19th Apr 2008 11:40 AM
Referencing a table with blank rows without creating extra rows ? ZMAN Microsoft Excel Discussion 4 28th Aug 2006 02:03 PM
Deleting extra OS Nick Windows XP Customization 0 13th Dec 2003 11:28 PM
Re: deleting an extra page Dave Neve Microsoft Word Document Management 0 8th Aug 2003 11:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:15 PM.