Consulting

Results 1 to 2 of 2

Thread: Looping through commands

  1. #1
    VBAX Regular
    Joined
    Jun 2011
    Posts
    28
    Location

    Looping through commands

    If I were to have 10 commands: invest1, invest2, invest3, etc.
    How could I run these through a loop to say, change their visibility?
    [VBA]
    for i = 1 to 10
    cmdInvest & i.Visible = False
    next i
    [/VBA]

    Looks pretty amateur..

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    For i = 1 To 10
    activesheet.Buttons("Invest" & i).Visible = False
    Next i [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •