Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Copying all Rows with data to a New worksheet

Now that I know how to scroll thru all of the rows looking for which
one has data.
How can I select all the rows and copy them to a new worksheet if there
is data in Column A.

I need to remove all of the blank rows from my spreadsheet. For some
reason even if the cell has no data excel saves it. So when I hit
Ctrl-End it doesn't go to the last cell with data but about 3000 rows
further.

Any Ideas

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Copying all Rows with data to a New worksheet

Sub vexed()
Dim r As Range
Set r = ActiveSheet.UsedRange
il = r.Rows.Count + r.Row - 1
Sheets("Sheet1").Select
k = 1
For ii = 1 To il
If IsEmpty(Cells(ii, 1)) Then
Else
Cells(ii, 1).EntireRow.Copy Sheets("Sheet2").Cells(k, 1)
k = k + 1
End If
Next
End Sub

This will search down column A in Sheet1; if it finds a non-empty cell it
will copy the entire row to Sheet2.
--
Gary''s Student


"VexedFist" wrote:

Now that I know how to scroll thru all of the rows looking for which
one has data.
How can I select all the rows and copy them to a new worksheet if there
is data in Column A.

I need to remove all of the blank rows from my spreadsheet. For some
reason even if the cell has no data excel saves it. So when I hit
Ctrl-End it doesn't go to the last cell with data but about 3000 rows
further.

Any Ideas


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
Copying rows of data into new worksheet but placing data into colu Thalarctos Excel Discussion (Misc queries) 0 June 6th 10 04:01 AM
Copying rows from 2 sheets to a new worksheet based on date criter Phill_Morgan Excel Discussion (Misc queries) 9 August 29th 07 08:03 AM
Copying data from one worksheet to another from rows to columns ked Excel Worksheet Functions 0 January 11th 07 06:21 PM
Copying Rows of data HJ Excel Programming 1 May 27th 05 06:15 PM
Problem copying rows to new worksheet caksey Excel Programming 7 February 26th 04 03:11 PM


All times are GMT +1. The time now is 06:01 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"