+ Reply to Thread
Results 1 to 4 of 4

naming text boxes with counter - Syntax

Hybrid View

BuZZarD73 naming text boxes with... 02-10-2015, 08:16 AM
Kyle123 Re: naming text boxes with... 02-10-2015, 08:18 AM
BuZZarD73 Re: naming text boxes with... 02-10-2015, 08:47 AM
Kyle123 Re: naming text boxes with... 02-10-2015, 08:49 AM
  1. #1
    Forum Contributor
    Join Date
    09-17-2014
    Location
    UK
    MS-Off Ver
    2007
    Posts
    117

    naming text boxes with counter - Syntax

    Should be simple but I can't get it correct....
    I have a number of textboxes on a userform which I need to loop through and do stuff for each box.

    These tend be named in groups such as txtproject1, txtproject2, txtproject3 etc

    I have to run similar code on each of these so I'd have the same block of code triplicated - one block for each textbox.

    What I'd like to do is address each box by name and counter value, so Me.textbox & 1, Me.textbox & 2 etc but not sure how to address this correctly. - in my head it's something like Me.textbox & (i), so on each pass of the loop, it can address the next box in the sequence.

    Can I address them in this way and if so, what's the correct syntax?

    Thanks

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: naming text boxes with counter - Syntax

    Me.Controls("Textbox" & i)

  3. #3
    Forum Contributor
    Join Date
    09-17-2014
    Location
    UK
    MS-Off Ver
    2007
    Posts
    117

    Re: naming text boxes with counter - Syntax

    Fabulous... Thanks

    We're rolling again

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: naming text boxes with counter - Syntax

    No problem

+ 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. need some help with a counter for check boxes
    By RedZoneOS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-09-2014, 08:30 AM
  2. [SOLVED] Syntax for naming a range using 2 variables
    By kirk70 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2013, 12:45 PM
  3. Syntax for range naming
    By highlystrung in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-15-2011, 04:20 PM
  4. Replies: 4
    Last Post: 05-22-2011, 10:19 AM
  5. Replies: 2
    Last Post: 02-19-2010, 03:55 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