[RESOLVED] Dynamic fields in Excel userform-VBForums
Results 1 to 2 of 2

Thread: [RESOLVED] Dynamic fields in Excel userform

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    2

    Resolved [RESOLVED] Dynamic fields in Excel userform

    Hi all -

    I'm real new to VBA (yesterday, for that matter) and I've managed to create a simple userform that grabs data, passes it to my procedure and then spits out some output very nicely.

    Now to my problem:

    What I'd like to do is to create another userform that takes a user-entered number, say '6', and then will generate another user input form with 6 entry fields that will be loaded into an array for future processing.

    I've searched high and low and couldn't find what seems to be a solution, but that also could be a function of my basic VBA knowledge. Any help and/or alternative methods appreciated.

    Thanks!

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    19,873

    Re: Dynamic fields in Excel userform

    What I'd like to do is to create another userform that takes a user-entered number, say '6', and then will generate another user input form with 6 entry fields that will be loaded into an array for future processing.
    i am sure this would be simple if i could understand what you want to do
    for a guess it you want to load a form with ? number of textboxes, you could create a form with the maximum number of possibly required boxes, set all to visible = false then just set the required number to visible = true, possibly resize the form to suit the number of boxes

    Code:
    for i = 1 to numrequired
        useform1.controls("textbox" & i).visible = true
    next
    where number required is the value entered in the textbox in first form

    there would be several methods to do like this
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.