+ Reply to Thread
Results 1 to 2 of 2

putting an input box inside a macro

  1. #1
    Registered User
    Join Date
    05-25-2006
    Posts
    22

    putting an input box inside a macro

    Join Date: May 2006
    Posts: 19

    Input box inside a macro

    --------------------------------------------------------------------------------

    Ok, I need to create a button with a macro attached which allows me to delete columns within a worksheet,

    in this macro I must include an input box which asks the user to either
    identify as 'the treasurer' and delete all 'financial' data

    Sheets("Membership").Select
    Range("G3:H17,K3:K17").Select
    Range("K3").Activate
    Selection.ClearContents
    End Sub

    or identify as 'the registrar' and delete all 'results' data

    Sheets("Results").Select
    Range("E3:I17").Select
    Selection.ClearContents
    End Sub

    how do I this?, above is two seperate macros I have recorded which I want to combine with an input box, can anybody give me an example that I can copy and paste into the macro??

  2. #2
    Ardus Petus
    Guest

    Re: putting an input box inside a macro

    (untested):

    sub Tester()
    dim sUser as string
    sUser = InputBox "Enter user name"
    select case sUser
    case "the treasurer"
    Worksheets("Membership").range("G3:H17,K3:K17").Clearcontents
    case "the registrar"
    Worksheets("Results").range("E3:E17").Clearcontents
    case else
    msgbox "Invalid input"
    end select
    end Sub


    HTH
    --
    AP

    "Drummy" <[email protected]> a écrit dans
    le message de news: [email protected]...
    >
    > Join Date: May 2006
    > Posts: 19
    >
    > Input box inside a macro
    >
    > --------------------------------------------------------------------------------
    >
    > Ok, I need to create a button with a macro attached which allows me to
    > delete columns within a worksheet,
    >
    > in this macro I must include an input box which asks the user to
    > either
    > identify as 'the treasurer' and delete all 'financial' data
    >
    > Sheets("Membership").Select
    > Range("G3:H17,K3:K17").Select
    > Range("K3").Activate
    > Selection.ClearContents
    > End Sub
    >
    > or identify as 'the registrar' and delete all 'results' data
    >
    > Sheets("Results").Select
    > Range("E3:I17").Select
    > Selection.ClearContents
    > End Sub
    >
    > how do I this?, above is two seperate macros I have recorded which I
    > want to combine with an input box, can anybody give me an example that
    > I can copy and paste into the macro??
    >
    >
    > --
    > Drummy
    > ------------------------------------------------------------------------
    > Drummy's Profile:
    > http://www.excelforum.com/member.php...o&userid=34780
    > View this thread: http://www.excelforum.com/showthread...hreadid=549322
    >




+ 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