+ Reply to Thread
Results 1 to 2 of 2

Copy Checkbox and change texbox link

  1. #1
    Forum Contributor
    Join Date
    11-27-2009
    Location
    Oxford
    MS-Off Ver
    Excel 2003, 2007 and 2010
    Posts
    120

    Exclamation Copy Checkbox and change texbox link

    Hey all,

    I am having a problem with getting a checkbox to relate to a specific textbox.

    I have a template where if the checkbox is ticked the textbox is unhidden and if it is unticked it is hidden.

    what I want to do is to be able to copy and paste this textbox and checkbox, the problem is that once I paste it the checkbox doesnt relate to the new textbox pasted in. it still relates to the textbox it was copied from.

    is there a way to change this to the new textbox?

    Thanks

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Copy Checkbox and change texbox link

    I think you should be grateful that VBA doesn't do what you expect.
    If you copy an object a new object is being made. All the object's properties are being copied too. The link that you made between the checkbox and Textbox is not part of the object's properties.
    By copying a textbox and a checkbox you create 2 new objects in the userform. They get new codenames automatically. if you want to establish a comparable connection between them you have to copy the VBA-code too and adapt it to the new names VBA created for you.

    If you are able to do this by VBA instead of manually, you can do this operation fully controlled (copying objects, adapting names, adding VBA-code for the checkbox's Click-event).

+ 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