+ Reply to Thread
Results 1 to 8 of 8

Macro to delete unwanted data

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Macro to delete unwanted data

    Need a MACRO to delete unwanted data...
    MACRO needs to be activated when sheet is open..
    Attach is the sheet for explanation..
    In the main sheet the highted data needs to be deleted...
    Once all unwanted cells deleted the file should look like as in Sheet1.

    FYI : Column A : Do a search for all Data with value=0 and delete all rows
    Delete Column B,C.D.G,H,I,J,k,L,M,N,O,P
    Once all of the above done Sort Column A A>>Z...

    i hope this is clear explanation...

    Thank u in advance for help..
    Attached Files Attached Files

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    In order to delete rows based on cell value, you can adapt following macro to your specific needs ...
    Please Login or Register  to view this content.
    HTH
    Carim


    Top Excel Links

  3. #3
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434
    Thank U...Carim

    It works and i will implement according to my needs.
    Good thing is that i have managed to write a VB macro to delete columns.
    This is the cript i wrote to delete the unwanted colums...

    Sub DeleteColumn()
    Dim J As Integer
    Dim K As Integer
    J = 0
    For J = 0 To 4
    J = J + 1
    Cells(1, 2).Select
    ActiveCell.EntireColumn.Delete
    If J = 4 Then
    End If
    Next J
    K = 0
    For K = 0 To 18
    K = K + 1
    Cells(1, 4).Select
    ActiveCell.EntireColumn.Delete
    If K = 18 Then
    End If
    Next K
    Cells(1, 1).Select
    End Sub


    However i would like to know further about this macro we created.
    Let me explain u my situation.
    i will have 1 file every day as attached earlier.
    The name of the file would be in the format : Date_StoreName_TC_RPT.xls.
    Now i have 2 Macro script to delete rows and columns of unwanted data.
    The format of the file i will get every day would be the same as per earlier attachment.

    My question is how do i implement the Macro to new file every day.

    I am really appreciating your help and am also learning a lot from u guys

    Thank u

  4. #4
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi again,

    There are several solutions ...
    Most probably, the easiest one is to store your macros into your personal.xls file ... By doing so, your two macros become always available ...

  5. #5
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434
    Can you be more specific by refering to personal.xls
    Would i create a blank xls sheet name personal.xls and have those 2 macros in this sheet. if so how would i save so that i can have 'deleteRow' and "deleteColumn" macro available always....

    Thank U...

  6. #6
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Well ... personal.xls is a hidden workbook which is always available ...
    To add your macros into this module, take a look at David's explanation ...
    http://www.mvps.org/dmcritchie/excel/getstarted.htm

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Smile

    I got it ....

    Thank U...

  8. #8
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Glad you could fix your problem

    Thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1