VBA Code Help

  • Hi all,


    I am quite new to the VBA world but needed some help with a code. I have a set of data with certain column titles that I would like the macro to find, delete, and arrange to form a generated report. I have got it to work fine, but recently added more columns to the set of data and now even with adjusting the code it doesnt act right. It seems to pick certain columns before others even though its set to find the proper text in the column header. Im getting stumped and frustrated. Any help would be appreciated!

  • Hello and Welcome to the Forum ...:smile:


    In order to fix your problem ... you should attach your file with an explanation of your expected result ...:wink:

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • 'Delete x

    Set Obj = wsActiveSheet.Cells.Find("x")
    If Obj Is Nothing Then
    MsgBox "Target column is not found"
    Else
    AreaY = wsActiveSheet.Cells.Find("x").Row
    AreaX = wsActiveSheet.Cells.Find("x").Column
    End If


    Columns(AreaX).Select
    Selection.EntireColumn.Delete



    Current code im using to delete columns. It seems the order of the data seems to affect what the code is choosing to delete.

  • Unfortunately ...a portion of your macro is not going to help ...


    In order to fix your problem ... you should attach your file with an explanation of your expected result ...:wink:

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!