+ Reply to Thread
Results 1 to 4 of 4

inputbox to select cells instead of typing cell locations

Hybrid View

  1. #1
    Registered User
    Join Date
    04-14-2013
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    14

    inputbox to select cells instead of typing cell locations

    Hi, as stated in title, I need to macro an inputbox to let me select cells instead of prompt me to enter cells.
    For example, I need to select cells in column P, but number of rows is different everytime, eg. sometimes I want P10:P11 or P10,P12,P14....

    x = InputBox("Enter changing cells, for example: $P$10,$P$11", "Changing Cells", "$P$10,$P$11")
    my current code just allow me to enter cells, how should I modify the code to select the cells instead of typing it?

    Thanks for any replies!!!!

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: inputbox to select cells instead of typing cell locations

    Probably a userform would be necessary for this. You could apply ranges to buttons (just as an example) and when the user selects a range the code can do whatever to that range.

    If you ranges will change, I don't see how the user will be able to select a range they want without actually entering the range. Of course, I may not be understanding you correctly either.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: inputbox to select cells instead of typing cell locations

    perhaps
    set myrange = application.InputBox(Prompt:="Select changing cells", title:="Changing Cells", type:=8)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  4. #4
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: inputbox to select cells instead of typing cell locations

    Try this:

    Set x = Application.InputBox("Select cells", "Selection", , , , , , 8)

+ 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