Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 192
Default How to select cells with values only (not empty ones)?

My problem is that I am using a macro to copy data from one workbook and to
paste into the next, however along with the data I need come about 30,000
blank rows, making the file large.

I could use Go Toblanks and Delete the 30,000 once pasted but that takes
alot of time to sit through.

Idealy I could use Go To(Insert something that selects only non-empty cells)

And then copy/paste that into the new workbook.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default How to select cells with values only (not empty ones)?

Are the rows really blank ? and are they between the data or below the data

You can use AutoFilter in the code and filter for non blanks and copy to the other sheet

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Nick" wrote in message ...
My problem is that I am using a macro to copy data from one workbook and to
paste into the next, however along with the data I need come about 30,000
blank rows, making the file large.

I could use Go Toblanks and Delete the 30,000 once pasted but that takes
alot of time to sit through.

Idealy I could use Go To(Insert something that selects only non-empty cells)

And then copy/paste that into the new workbook.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 192
Default How to select cells with values only (not empty ones)?

They are blank and they are below all of the data, I would need an example
autofilter line, because I am having trouble executing it manually and do not
physically write the macro but act it out and make small edits if I have to.

Thanks

"Ron de Bruin" wrote:

Are the rows really blank ? and are they between the data or below the data

You can use AutoFilter in the code and filter for non blanks and copy to the other sheet

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Nick" wrote in message ...
My problem is that I am using a macro to copy data from one workbook and to
paste into the next, however along with the data I need come about 30,000
blank rows, making the file large.

I could use Go Toblanks and Delete the 30,000 once pasted but that takes
alot of time to sit through.

Idealy I could use Go To(Insert something that selects only non-empty cells)

And then copy/paste that into the new workbook.


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 192
Default How to select cells with values only (not empty ones)?

The blank fields are blank and below all the of the data I need (not mixed in
between)

I would need an autofilter example, because I can't actually execute it,
unless I am missing something and do not write the macros myself, just make
them and do small edits.

"Ron de Bruin" wrote:

Are the rows really blank ? and are they between the data or below the data

You can use AutoFilter in the code and filter for non blanks and copy to the other sheet

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Nick" wrote in message ...
My problem is that I am using a macro to copy data from one workbook and to
paste into the next, however along with the data I need come about 30,000
blank rows, making the file large.

I could use Go Toblanks and Delete the 30,000 once pasted but that takes
alot of time to sit through.

Idealy I could use Go To(Insert something that selects only non-empty cells)

And then copy/paste that into the new workbook.


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default How to select cells with values only (not empty ones)?

OK, try this for column A on "Sheet1"
(A1 is the header cell of the column)


Sub Copy_With_AutoFilter1()
Dim WS As Worksheet
Dim WSNew As Worksheet
Dim rng As Range
Dim rng2 As Range

Set WS = Sheets("sheet1") '<<< Change
'A1 is the top left cell of your filter range and the header of the first column
Set rng = WS.Range("A:A")

'Close AutoFilter first
WS.AutoFilterMode = False

'This example filter on the first column in the range (change the field if needed)
rng.AutoFilter Field:=1, Criteria1:="<" & ""

Set WSNew = Worksheets.Add

WS.AutoFilter.Range.Copy
With WSNew.Range("A1")
' Paste:=8 will copy the columnwidth in Excel 2000 and higher
.PasteSpecial Paste:=8
.PasteSpecial xlPasteValues
.PasteSpecial xlPasteFormats
Application.CutCopyMode = False
.Select
End With

WS.AutoFilterMode = False

End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Nick" wrote in message ...
They are blank and they are below all of the data, I would need an example
autofilter line, because I am having trouble executing it manually and do not
physically write the macro but act it out and make small edits if I have to.

Thanks

"Ron de Bruin" wrote:

Are the rows really blank ? and are they between the data or below the data

You can use AutoFilter in the code and filter for non blanks and copy to the other sheet

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Nick" wrote in message ...
My problem is that I am using a macro to copy data from one workbook and to
paste into the next, however along with the data I need come about 30,000
blank rows, making the file large.

I could use Go Toblanks and Delete the 30,000 once pasted but that takes
alot of time to sit through.

Idealy I could use Go To(Insert something that selects only non-empty cells)

And then copy/paste that into the new workbook.


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
When creating a formula how do you select only visible cells fuadramsey Excel Discussion (Misc queries) 1 June 13th 06 01:35 AM
Save trailing empty cells in a tab delimited text file osios Excel Discussion (Misc queries) 3 April 24th 06 08:54 AM
How can I convert empty strings to empty cells? Shane Excel Discussion (Misc queries) 2 July 19th 05 12:10 PM
Counting empty cells within a range of cells Rosehill - ExcelForums.com New Users to Excel 2 May 2nd 05 08:53 AM
Counting empty cells within a range of cells Rosehill - ExcelForums.com New Users to Excel 0 April 7th 05 12:47 AM


All times are GMT +1. The time now is 09:19 PM.

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"