Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA code for selecting and copying rows to another sheet.

Hi,

I have 39,000 rows of data in one spreadsheet.
I need some VBA code that will copy ONLY the rows where column A is
non-blank.
I want these few rows to be copied to another sheet in the same
workbook.
At best, there will be only about 30 rows that are non-blank in column
A.

Can you please give me the VBA code for doing this?

I have tried to use PivotTables. It does not work. It keeps saying
that I do not have enough memory.

Thanks,
Luther



------------------------------------------------
~~ 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: 96
Default VBA code for selecting and copying rows to another sheet.

I'm assuming that you're not interested in copying non-blanks from
Column A that contain formulas. If so, you'll have to modify the
macro.

Sub NoBlanks()
Columns("A").SpecialCells(xlCellTypeConstants).Ent ireRow.Copy
Sheets("OtherSheet").Range("A1").PasteSpecial xlPasteValues
End Sub

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

Hi,

I have 39,000 rows of data in one spreadsheet.
I need some VBA code that will copy ONLY the rows where column A is
non-blank.
I want these few rows to be copied to another sheet in the same
workbook.
At best, there will be only about 30 rows that are non-blank in column
A.

Can you please give me the VBA code for doing this?

I have tried to use PivotTables. It does not work. It keeps saying
that I do not have enough memory.

Thanks,
Luther



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA code for selecting and copying rows to another sheet.

Thanks. This is what I needed.

Can you tell me what needs to be changed to copy only columns 2 thru 6
in every row instead of the entire row?



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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA code for selecting and copying rows to another sheet.

Sub CopyData()
Dim rng As Range
Set rng = Columns("A").SpecialCells(xlCellTypeConstants).Ent ireRow
Set rng = Intersect(rng, Range("B:F"))
rng.Copy
Sheets("OtherSheet").Range("A1").PasteSpecial xlPasteValues
Application.CutCopyMode = False
End Sub

--
Regards,
Tom Ogilvy



"lothario" wrote in message
...
Thanks. This is what I needed.

Can you tell me what needs to be changed to copy only columns 2 thru 6
in every row instead of the entire row?



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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA code for selecting and copying rows to another sheet.

Thanks.
This helped.



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

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
Selecting rows to another sheet Muskrat24 Excel Worksheet Functions 2 June 23rd 09 05:04 PM
Copying rows from one sheet to another.... Buyone Excel Worksheet Functions 1 June 20th 07 10:56 PM
copying rows from next sheet over ayl322 Excel Discussion (Misc queries) 3 November 22nd 05 07:39 PM
Copying whole rows to different sheet once found Gordy w/Hi Expectations Excel Discussion (Misc queries) 8 October 31st 05 01:00 PM
Copying selected rows to another sheet tacarme Excel Worksheet Functions 3 June 25th 05 11:46 AM


All times are GMT +1. The time now is 06:23 AM.

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"