+ Reply to Thread
Results 1 to 5 of 5

VBA Display Input Box to Add Value to Cell

  1. #1
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    VBA Display Input Box to Add Value to Cell

    Hi, I wonder whether someone may be able to help me please.

    I'm using the code below to create multiple sheets in a given workbook.

    Please Login or Register  to view this content.
    The code works except for this line:
    Please Login or Register  to view this content.
    What I'm trying to achieve, is to dispaly an 'Input Box' to allow the user to enter a date which will populate cell B3 in each of the created sheets. However, when I run this, although I can display the 'Input Box', when I enter the data, and click 'Ok', I receive a 'Run time' error highlighting this line as the cause.

    I just wondered whether someone may be able to look at this please and let me know where I'm going wrong.

    Many thanks and kind regards

    Chris

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: VBA Display Input Box to Add Value to Cell

    shArray is a variant array of text. Not actual sheets.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Display Input Box to Add Value to Cell

    Hi Andy, thank you very much for coming back to me with this.

    I tried the code you kindly provided, and although this displays the 'Input Box' and allows the user to enter the date, the 'Input box' is displayed for each sheet in the array, rather than once, which I was hoping for.

    Many thanks and kind regards

    Chris

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: VBA Display Input Box to Add Value to Cell

    Start by taking the InputBox command out of the loop.
    Get the value first then apply to each sheet in loop

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Display Input Box to Add Value to Cell

    Hi Andy, thank you for coming back to me with this with the code and the explanation on the change.

    The code works perfectly!

    All the best and kind regards

    Chris

+ 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] VBA to display Input box and enter cell value
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-13-2014, 05:54 PM
  2. Display all data associated with input in given cell
    By davo1224 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-12-2010, 11:48 AM
  3. Can name range display value based on the input of specific cell?
    By rusoo7 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-24-2010, 11:17 AM
  4. Replies: 1
    Last Post: 08-29-2009, 01:10 PM
  5. Cell Category (Number) input Display
    By Bracknell in forum Excel General
    Replies: 1
    Last Post: 07-16-2007, 10:06 AM

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