+ Reply to Thread
Results 1 to 4 of 4

populate cell with textbox value when checkbox is true on another worksheet

  1. #1
    Forum Contributor
    Join Date
    08-10-2014
    Location
    Alberta
    MS-Off Ver
    2016
    Posts
    128

    populate cell with textbox value when checkbox is true on another worksheet

    I am able to populate a cell with the textbox value when a checkbox is true on the same worksheet, but I cannot find out how to do it with another worksheet in the same workbook. I actually need to do this multiple times, but I can figure it out later.

    The worksheet I am working on is Sheet1 and the textbox needs to populate Sheet4. It is the last one, Pbox is what I need work with. The textbox I need is "Banname"

    Here is the code:
    Please Login or Register  to view this content.
    Last edited by Templemind; 09-06-2014 at 03:54 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: populate cell with textbox value when checkbox is true on another worksheet

    Let me make sure I understand your question. Sheet1 has a checkbox called Pbox and a textbox called Banname. If Pbox is checked, then you want the value from Banname to be copied to a cell on Sheet4. Your code does that. What exactly is the problem you are having with this code?

    Where is this code located? Is this in a UserForm? Your description talks about a checkbox on a worksheet, but the code refers to unloading a UserForm. Can you clarify what controls are where, and what modules contain the code?

    This is not the source of your problem but you are using With statements but not taking advantage of them in the code. A With allows you to omit the qualification of an object. For example, you are using With but still explicitly qualifying references to Sheet4 objects:
    Please Login or Register  to view this content.
    but the With allows you to remove those qualifications:
    Please Login or Register  to view this content.
    Wherever you have an expression starting with a dot, VBA will use the qualification from the With statement before the dot.

    However, that doesn't mean your code won't work, it just means that the With doesn't do anything.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    08-10-2014
    Location
    Alberta
    MS-Off Ver
    2016
    Posts
    128

    Re: populate cell with textbox value when checkbox is true on another worksheet

    Thank you, that worked. It was part of a user form. The reason why I made so many references to Sheet4 was because it didn't seem to work for me when I didn't; I just wanted it to work.

    I just started vba the other day, and it is complicated, but I am understanding more. Again, thank you.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: populate cell with textbox value when checkbox is true on another worksheet

    That's odd. The change I showed should have made no difference in whether the code worked. I was just pointing out something that was probably confusing you.

+ 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. Populate a worksheet cell from a textbox to the next available cell in column B
    By molesy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-22-2013, 08:28 PM
  2. [SOLVED] Removing the True/False within cell when linked to Checkbox
    By MadelynL in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-20-2013, 03:04 PM
  3. how to make checkbox true selecting then chaning 2nd box true when null
    By ferrum_equitis in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2012, 01:13 PM
  4. Filling in a cell based on Checkbox true/false
    By Rivalwon in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-10-2007, 07:07 PM
  5. [SOLVED] Populate checkbox values in user form to cell
    By in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-01-1970, 12:00 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