Results 1 to 2 of 2

Having the control source from a user form as a macro in a loop

Threaded View

  1. #1
    Registered User
    Join Date
    01-17-2011
    Location
    calgary, alberta
    MS-Off Ver
    Excel 2003
    Posts
    61

    Having the control source from a user form as a macro in a loop

    Hello,

    I have a user form created where there are four option buttons whereby the user will select one of the options. Currently, I have a macro that calls the userform to open, and the four control sources (from the userform properties box) pointing to cells in the same worksheet where I can then take the TRUE or FALSE values and use them in another worksheet. What I need to do is somehow within the loop of my macro have the control source pointing to these cells (even in another worksheet if possible, but not necessary). This will allow me to fill a range of cells with the user inputs, and maintain these inputs, rather than just overwriting one cell over and over again everytime the userform selection changes. I hope this makes sense but if not, let me know.

    Any help would be awesome.

    Thanks.

    Here is what I have and I believe the code I'm requiring needs to be inserted under the line "Userform1.show" and "Userform2.show".

    Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Intersect(Target, Range("B17:B43")) Is Nothing Then Exit Sub
    If IsEmpty(Target.Value) Then Exit Sub
    If Target.Cells.Count > 1 Then Exit Sub     'makes sure no action is taken if user changes several cells at once
    If LCase(Left( _
        Target.Value, 9)) = "ballistic" Then        'when ballistic operation is selected, run this code
            
            Sheet1.Range("b100:b103").Clear
            Sheet1.Range("c100:c103").Clear
            UserForm1.Show
            
               ElseIf LCase(Left( _
                Target.Value, 7)) = "logging" Then      'when logging operation is selected, run this code
                
                Sheet1.Range("b100:b103").Clear
                Sheet1.Range("c100:c103").Clear
                UserForm2.Show
    Last edited by calmena; 03-31-2011 at 01:00 PM.

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