PC Review


Reply
Thread Tools Rate Thread

Copying all Rows with data to a New worksheet

 
 
VexedFist
Guest
Posts: n/a
 
      5th Oct 2006
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 With Quote
 
 
 
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      5th Oct 2006
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 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
Copying rows of data into new worksheet but placing data into colu Thalarctos Microsoft Excel Misc 1 6th Jun 2010 04:38 PM
Copying selected rows into new worksheet PVANS Microsoft Excel Programming 2 31st Jul 2009 04:04 PM
Copying rows from worksheet A to worksheet B based on criteria =?Utf-8?B?am1tMDYyNg==?= Microsoft Excel Programming 2 11th Apr 2007 01:36 AM
Copying the filtered data to clipboard is copying non-visible rows =?Utf-8?B?U2VldGhhUmFtYW4=?= Microsoft Excel Crashes 10 12th Jul 2006 09:39 PM
Problem copying rows to new worksheet caksey Microsoft Excel Programming 7 26th Feb 2004 03:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:11 PM.