Consulting

Results 1 to 3 of 3

Thread: unload userform if greater than certain row

  1. #1
    VBAX Tutor
    Joined
    Jul 2010
    Posts
    225
    Location

    unload userform if greater than certain row

    I have a userform that will activate if in column a. However I do not want it to activate if it is below a certain row.

    eg range("ak301").value which gives me the row number I want the userform to stop activating at.

    Is there a way to use an if statement to include if below row ak301's value (eg row 354) then unload userform or exit?


    my userform is called Names1


    [vba]Private Sub UserForm_Initialize()
    ComboBox1.RowSource = "COMPLETE_NAME"
    ComboBox1.Value = ActiveCell.Value
    With ComboBox1
    .SelStart = 0

    .SelLength = Len(ComboBox1)

    End With
    End Sub[/vba]

  2. #2
    VBAX Tutor
    Joined
    Jul 2010
    Posts
    225
    Location
    I use the selection change to initialize userform below. Would this be where I put code?

    [VBA]Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If ActiveCell.Column = 1 Then
    Names1.Show

    End If
    End Sub[/VBA]

  3. #3
    VBAX Expert shrivallabha's Avatar
    Joined
    Jan 2010
    Location
    Mumbai
    Posts
    750
    Location
    Quote Originally Posted by wilg
    I use the selection change to initialize userform below. Would this be where I put code?

    [vba]Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If ActiveCell.Column = 1 Then
    Names1.Show

    End If
    End Sub[/vba]
    Something like:
    [VBA]Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Column = 1 And Target.Row < Range("AK301").Value Then
    Names1.Show
    End If
    End Sub[/VBA]
    Regards,
    --------------------------------------------------------------------------------------------------------
    Shrivallabha
    --------------------------------------------------------------------------------------------------------
    Using Excel 2016 in Home / 2010 in Office
    --------------------------------------------------------------------------------------------------------

Posting Permissions

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