Results 1 to 4 of 4

Variable Controls

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-09-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    315

    Variable Controls

    Hi

    What's the syntax for referring to a variable control name?

    I have a userform with 20 textboxes (txtAmount1, txtAmount2 etc) and I want to loop through each of those controls, so I want to do something like:

    For varRow = 1 To 20
        Me.txtAmount" & varRow & ".text = "whatever"
    Next varRow

    I know I can loop through all controls on the form (and restrict based on control name) but I want to be able to do something similar to the above for other reasons: I have another column of textboxes (txtSupplier1, txtSupplier2 etc) and if I update txtSupplier2 then I want to update the corresponding txtAmount2.

    Any help is appreciated.

    Dion
    Last edited by mojo249; 09-10-2011 at 11:33 AM.

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