+ Reply to Thread
Results 1 to 5 of 5

Populate inputbox when clicking on cells

  1. #1
    Forum Contributor
    Join Date
    11-21-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    150

    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 Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    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 Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,143

    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 mjr veverka; 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,573

    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
    Forum Contributor
    Join Date
    11-21-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    150

    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)

Similar Threads

  1. [SOLVED] Populate Date by Clicking on Cell
    By Canuck Chuck in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-28-2016, 11:45 AM
  2. [SOLVED] MACRO: If user clicks cancel in inputbox,then do nothing. Problem with inputbox appearance
    By Tona in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-05-2015, 04:33 AM
  3. Populate a cell with a value simply by clicking on it
    By jvp123 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-15-2014, 02:11 PM
  4. Populate the range of data in Userform by clicking on cell value which is related
    By haridevadiga in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-28-2013, 02:31 AM
  5. Replies: 0
    Last Post: 08-08-2012, 01:02 PM
  6. Populate dropDown in a custom ribbon on clicking a button
    By johnjacobt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-01-2011, 05:02 AM
  7. Using an InputBox to populate a cell
    By carsto in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-05-2007, 12:12 PM

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