+ Reply to Thread
Results 1 to 3 of 3

Text box and command button to copy

  1. #1
    Registered User
    Join Date
    06-29-2009
    Location
    Manila, Philippines
    MS-Off Ver
    Microsft 365 Apps for Enterprise
    Posts
    18

    Text box and command button to copy

    I know how to copy text box with command button. I have 200 text boxes and 200 command buttons which is a very long version of doing so.

    Is there any way to it like

    Textbox(a) is for commandbutton(a)

    Like a function or something

    I had to do it manually every time I add, textboxes for all 200 of them



    Dim txt1 as New DataObject
    Txt1.setText Textbox1.text
    txt1.putinclioboard
    End sub

    Is there a shortcut?
    Attached Images Attached Images

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,937

    Re: Text box and command button to copy

    You can create a class module that creates a collection of command buttons that all use the same click event. You just need to set the Tag value of each commandbutton to the numeric part of the textbox name.

    Change UserForm1 to your actual userform name.

    In a standard code module:
    Please Login or Register  to view this content.
    In a new class module named clsCmdButton
    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    06-29-2009
    Location
    Manila, Philippines
    MS-Off Ver
    Microsft 365 Apps for Enterprise
    Posts
    18

    Re: Text box and command button to copy

    Thanks for the code. I can't open this website on my work laptop so I cant uplaod like a copy of what I had there.

    i tried to create and use the code below, can you help me check as when I run it, it does not copy what's on the text box. I've attached a file
    Attached Files Attached Files

+ 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] Copying ActiveX Command Button from master sheet to subsheets. command button code missing
    By popper08 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-13-2020, 10:15 AM
  2. Simple Copy/Paste work with Control Button but not for Command Button
    By tuongtu3 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-07-2019, 05:33 PM
  3. Replies: 2
    Last Post: 02-02-2016, 10:27 PM
  4. VBA code to create command button. Print all sheets then delete command button.
    By Declamatory in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-15-2015, 05:18 PM
  5. [SOLVED] Copy text to clipboard based on CheckBox value on Command Button click
    By askpcguy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-17-2014, 01:21 AM
  6. Sum Text Box Using Command Button
    By esaban in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-21-2014, 03:34 PM
  7. Replies: 1
    Last Post: 09-17-2007, 09:57 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