+ Reply to Thread
Results 1 to 5 of 5

Populate inputbox when clicking on cells

  1. #1
    Registered User
    Join Date
    11-21-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    69

    Populate inputbox when clicking on cells

    I created an inputbox that takes the value entered and multiplies it by each of the percentage totals in cells D45:D47.

    Although the inputbox works just fine, I need it to populate when I click on cells D45:D47. Originally, I tried referencing the inputbox in the subroutine (ByVal Target As Range), but it doesn’t recognize the inputbox (please see attached).

    Is there a way to reference the inputbox to show when I click on cells D45:D47 or do I have to create a separate userform and then reference it back in? I also tried creating a userform, but ran into a number of issues with that too. I feel like I'm spinning in the mud.

    Any and all help would be appreciated.
    Attached Files Attached Files

  2. #2
    Forum Guru davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    XL 2010,2016
    Posts
    10,843

    Re: Populate inputbox when clicking on cells

    There may be confusion between a UserForm and an Inputbox.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    will not work unless you have an userform called InputBox
    To call an InputBox when you have selected that specified range,
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    374

    Re: Populate inputbox when clicking on cells

    You already have the right macros, you just need to connect them together ('Worksheet_SelectionChange' and 'Test'), i.e. call 'Test' from 'Worksheet_SelectionChange' (Call Test):
    ... ?

    Ps:
    If your system decimal separator is period (.) then 'Dim length As Variant' not "Double', e.g.:
    Please Login or Register  to view this content.
    Last edited by porucha vevrku; 01-03-2018 at 03:25 PM.

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,200

    Re: Populate inputbox when clicking on cells

    Be sure to put the Selection event into the Sheet object, not a Module. Right click the sheet's tab, View Code, and paste. Test() can go to a Module.

    I would not use Len or Length as a variable name.

    Val() as explained, can be used on a Userform's Textbox Value to coerce it into a number if you go that route.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-21-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    69

    Re: Populate inputbox when clicking on cells

    Thank you all for the help. This has been very informative for me .

+ 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