+ Reply to Thread
Results 1 to 4 of 4

Thread: Delete a Column Based on User Entry

  1. #1
    Anice
    Guest

    Delete a Column Based on User Entry

    I need to have a Macro that prompts the user for a year to delete. The
    program would then search the worksheet for that year and delete all data in
    that column.

    Any suggestions would be great!! Thanks

  2. #2
    Don Guillett
    Guest

    Re: Delete a Column Based on User Entry

    have a look in vba help for
    INPUTBOX
    FIND

    --
    Don Guillett
    SalesAid Software
    dguillett1@austin.rr.com
    "Anice" <Anice@discussions.microsoft.com> wrote in message
    news:E24106B2-7B48-4702-99F2-F15AF00AE678@microsoft.com...
    >I need to have a Macro that prompts the user for a year to delete. The
    > program would then search the worksheet for that year and delete all data
    > in
    > that column.
    >
    > Any suggestions would be great!! Thanks




  3. #3
    Tom Ogilvy
    Guest

    RE: Delete a Column Based on User Entry

    Dim yr as Variant, rng as Range
    yr = Application.InputBox("Enter a year ex: 2004",type:=1)
    if yr = False then exit sub
    set rng = Rows(1).find(yr)
    if not rng is nothing then
    rng.EntireColumn.Delete
    end if

    --
    Regards,
    Tom Ogilvy


    "Anice" wrote:

    > I need to have a Macro that prompts the user for a year to delete. The
    > program would then search the worksheet for that year and delete all data in
    > that column.
    >
    > Any suggestions would be great!! Thanks


  4. #4
    Anice
    Guest

    RE: Delete a Column Based on User Entry

    Thank you very much. That worked beautifully!



    "Tom Ogilvy" wrote:

    > Dim yr as Variant, rng as Range
    > yr = Application.InputBox("Enter a year ex: 2004",type:=1)
    > if yr = False then exit sub
    > set rng = Rows(1).find(yr)
    > if not rng is nothing then
    > rng.EntireColumn.Delete
    > end if
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "Anice" wrote:
    >
    > > I need to have a Macro that prompts the user for a year to delete. The
    > > program would then search the worksheet for that year and delete all data in
    > > that column.
    > >
    > > Any suggestions would be great!! Thanks


+ 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.2.0