Consulting

Results 1 to 8 of 8

Thread: Solved: Delete blank rows.

  1. #1

    Solved: Delete blank rows.

    I'm working on this Macro, I need some help. I have a database with an estimate of 850 rows, When I filter the database, I did create a Macro to separate the rows depending on certain criteria, and then copy and paste the filtered info on a new sheet...Problem: When I run the macro the new Sheet has 64000 rows!, so I go from 35 KB to 25 MG!...I need either to add a new macro to DELETE all those blank rows or PASTE the Filtered Info in a way that won't paste the blank rows...Copy and Paste Special won't work!...

    Thanks for your help!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Show us your current code, it is difficult to see how you end up where you do.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    This is the Macro I'm Using to filter and Copy and Paste the info:

    [VBA]
    Sub FINALTABS2()
    Sheets("LS Sales").Select
    Selection.AutoFilter Field:=3, Criteria1:="*Under Ground Cash Secrets*", Operator:=xlOr _
    , Criteria2:="*InfoUSA*"
    routine2 ("UGCS Sales")

    Cells.Select
    Cells.EntireColumn.AutoFit
    Cells.EntireRow.AutoFit

    Sheets("LS Sales").Select
    Selection.AutoFilter Field:=3, Criteria1:="*Stephen Pierce*", Operator:=xlOr _
    , Criteria2:="*InfoUSA*"
    routine2 ("SP Sales")

    Cells.Select
    Cells.EntireColumn.AutoFit
    Cells.EntireRow.AutoFit

    Sheets("LS Sales").Select
    Selection.AutoFilter Field:=3, Criteria1:="*Rich Jerk*", Operator:=xlOr _
    , Criteria2:="*InfoUSA*"
    routine2 ("RJ Sales")

    Cells.Select
    Cells.EntireColumn.AutoFit
    Cells.EntireRow.AutoFit

    Sheets("LS Sales").Select
    Selection.AutoFilter Field:=3, Criteria1:="*Thrive*", Operator:=xlOr _
    , Criteria2:="*InfoUSA*"
    routine2 ("Thrv Sales ")

    Cells.Select
    Cells.EntireColumn.AutoFit
    Cells.EntireRow.AutoFit

    End Sub




    Function routine(nombre)
    Columns("A:I").Copy
    Sheets.Add
    ActiveSheet.Paste
    ActiveSheet.Name = nombre
    End Function
    Function routine1(nombre)
    Columns("A:J").Copy
    Sheets.Add
    ActiveSheet.Paste
    ActiveSheet.Name = nombre
    End Function
    Function routine2(nombre)
    Columns("A:F").Copy
    Sheets.Add
    ActiveSheet.Paste
    ActiveSheet.Name = nombre
    End Function
    [/VBA]

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Can you post some sample data? Use Manage Attachments in the Go Advanced reply section.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5

    File Example

    This is one example of the database I'm managing...

    Thanks
    Last edited by alopecito08; 11-07-2008 at 11:11 AM.

  6. #6
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    [VBA]Function routine(nombre)
    Intersect(Columns("A:I"), ActiveSheet.UsedRange).Copy
    Sheets.Add
    ActiveSheet.Paste
    ActiveSheet.Name = nombre
    End Function
    [/VBA]

    etc.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  7. #7
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    BTW, No need to select Cells

    [VBA]
    'Cells.Select
    Cells.EntireColumn.AutoFit
    Cells.EntireRow.AutoFit

    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  8. #8
    It works!....You're the best!

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •