Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select Data only

Hello All,

I wonder if you can help with this (probably simple) problem.


Each worksheet Im working on may have several hundred rows, though each
one a different number of rows.
Im compiling them all to one worksheet.

The columns used, however, are set. So I'm trying to make a macro to
Select all the columns but only as far down as the data goes.

I'll need a similar (probably) macro to search down in the "Combined"
worksheet, find the first free row and ValuePaste the data in there.

Ive got as far as realising it may be something to do with:

Range("A:M").Select
Range(Selection, Selection.End(xlDown)).Select

But thats as far as Ive got.

Any help much appreciated.

Thanks
Ed



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select Data only

Perhaps I have to use the R1C1 code, which Ive not looked at yet?



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Select Data only

One way:

If column A will have a value in each record, then this will copy
all the records on sheet1 to the next available row on sheet2:

With Worksheets("Sheet1")
.Range("A1:M" & .Range("A" & Rows.Count).End(xlUp).Row).Copy _
Destination:=Worksheets("Sheet2").Range("A" & _
End With

This technique has XL look "up" from the bottom row to find the last
row with data.

Note that you almost never need to select or activate a range in
order to work with it. Using the range object directly makes your
code smaller, faster and, IMO, easier to maintain.


In article ,
universal wrote:

Hello All,

I wonder if you can help with this (probably simple) problem.


Each worksheet Im working on may have several hundred rows, though each
one a different number of rows.
Im compiling them all to one worksheet.

The columns used, however, are set. So I'm trying to make a macro to
Select all the columns but only as far down as the data goes.

I'll need a similar (probably) macro to search down in the "Combined"
worksheet, find the first free row and ValuePaste the data in there.

Ive got as far as realising it may be something to do with:

Range("A:M").Select
Range(Selection, Selection.End(xlDown)).Select

But thats as far as Ive got.

Any help much appreciated.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Select Data only

I think J.E.'s code got truncated somehow:

With Worksheets("Sheet1")
.Range("A1:M" & .Range("A" & Rows.Count).End(xlUp).Row).Copy _
Destination:=Worksheets("Sheet2").Range("A" & _
Rows.Count).End(xlUp).Offset(1, 0)
End With

Might be what he really meant.


"J.E. McGimpsey" wrote:

One way:

If column A will have a value in each record, then this will copy
all the records on sheet1 to the next available row on sheet2:

With Worksheets("Sheet1")
.Range("A1:M" & .Range("A" & Rows.Count).End(xlUp).Row).Copy _
Destination:=Worksheets("Sheet2").Range("A" & _
End With

This technique has XL look "up" from the bottom row to find the last
row with data.

Note that you almost never need to select or activate a range in
order to work with it. Using the range object directly makes your
code smaller, faster and, IMO, easier to maintain.

In article ,
universal wrote:

Hello All,

I wonder if you can help with this (probably simple) problem.


Each worksheet Im working on may have several hundred rows, though each
one a different number of rows.
Im compiling them all to one worksheet.

The columns used, however, are set. So I'm trying to make a macro to
Select all the columns but only as far down as the data goes.

I'll need a similar (probably) macro to search down in the "Combined"
worksheet, find the first free row and ValuePaste the data in there.

Ive got as far as realising it may be something to do with:

Range("A:M").Select
Range(Selection, Selection.End(xlDown)).Select

But thats as far as Ive got.

Any help much appreciated.


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Select Data only

Yup - don't know what happened. Thanks for completing the code,
Dave.

In article ,
Dave Peterson wrote:

I think J.E.'s code got truncated somehow:

With Worksheets("Sheet1")
.Range("A1:M" & .Range("A" & Rows.Count).End(xlUp).Row).Copy _
Destination:=Worksheets("Sheet2").Range("A" & _
Rows.Count).End(xlUp).Offset(1, 0)
End With

Might be what he really meant.



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
How select all data points/data labels at once (to format)? kippers Charts and Charting in Excel 3 April 4th 23 12:39 PM
VBA: Column Select then Data Select then return to cell A1 James C[_2_] Excel Discussion (Misc queries) 3 February 1st 10 11:35 AM
highlight select data Lindsay Excel Discussion (Misc queries) 1 June 4th 09 06:36 PM
excel 2007, how to select a data point and cycle through data points [email protected] Charts and Charting in Excel 5 September 4th 07 12:29 PM
Select other workbook to select data in a macro. T Tromp Excel Programming 2 September 19th 03 01:43 PM


All times are GMT +1. The time now is 02:58 PM.

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

About Us

"It's about Microsoft Excel"