Try this Sub CopyNonBlankRow() On Error Resume Next Dim cell As Range Dim rng As Range Set rng = Sheets("sheet1").Range("B2:B" & Sheets("Sheet1").UsedRange.Rows.Count) Sheets("Data").Delete Sheets.Add.Name = "Data"
For Each cell In rng.Cells If cell.Value <> "" Then cell.EntireRow.Copy Sheets("Data").Activate Range("A" & Sheets("Data").Range("A10000").End(xlUp).Row + 1).Select ActiveSheet.Paste Application.CutCopyMode = False End If Next End Sub -----Original Message----- From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of vickey Sent: Monday, July 25, 2011 8:13 PM To: MS EXCEL AND VBA MACROS Subject: Re: $$Excel-Macros$$ filter of nonblank cell thanks but nonblank data is not being copied in data sheet..... On Jul 25, 7:29 pm, "Rajan_Verma" <rajanverma1...@gmail.com> wrote: > Try This > > Sub CopyNonBlankRow() > On Error Resume Next > Dim cell As Range > Dim rng As Range > Set rng = ActiveSheet.Range("B2:B" & ActiveSheet.UsedRange.Rows.Count) > Sheets("Data").Delete > Sheets.Add.Name = "Data" > > For Each cell In rng > If cell.Value <> "" Then cell.EntireRow.Copy > Sheets("Data").Range("A" & Sheets("Data").Range("A65536").End(xlUp).Row + 1) > Next > End Sub > > > > -----Original Message----- > From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] > > On Behalf Of vickey > Sent: Monday, July 25, 2011 7:42 PM > To: MS EXCEL AND VBA MACROS > Subject: $$Excel-Macros$$ filter of nonblank cell > > Is thereany way to filter / copy nonblank values toanother sheet. > > considering followng example. > > ID NAME > 1 AAAA > 2 BBB > 3 CCC > 4 > 5 > 6 > 7 DDD > 8 FFF > 9 EE > > ID NAME > 1 AAAA > 2 BBB > 3 CCC > 7 DDD > 8 FFF > 9 EE > > thanks in advance.... > > vikas > > -- > --------------------------------------------------------------------------- - > ------ > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links :http://twitter.com/exceldailytip > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials athttp://www.excel-macros.blogspot.com > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below linkhttp://www.facebook.com/discussexcel- Hide quoted text - > > - Show quoted text - -- ---------------------------------------------------------------------------- ------ Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel