+ Reply to Thread
Results 1 to 2 of 2

Make userform open when a blank cell in a range is selected, and not open if value in it

Hybrid View

  1. #1
    Registered User
    Join Date
    08-21-2013
    Location
    Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    44

    Make userform open when a blank cell in a range is selected, and not open if value in it

    I have a userform that I need to have open when a blank cell in Range ("A8:A51") is selected, but I don't need the userform to appear if the cell selected in Range("A8:A51") already has a value or text in it.

    The code I have now works but when I select any other cell on the sheet outside my range I get a Run-time error "91' Object variable or With block variable not set.

    Here is my code:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
    If Not Intersect(Target, Range("A8:A51")).Value <> "" Then
        If Target.Value = "" Then
            Application.EnableEvents = False
            Application.ScreenUpdating = False
            WorkSheet1_Form.Show
            Application.EnableEvents = True
            Application.ScreenUpdating = True
        End If
    
    End If
    
    
    End Sub
    I have tried a couple different scenarios but can't seem to figure it out. Any advice??

    Thanks

  2. #2
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    867

    Re: Make userform open when a blank cell in a range is selected, and not open if value in

    I bet you don't need that
    Application.EnableEvents = False
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

+ 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. open a userform next to the selected cell
    By chibouki in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-03-2016, 11:39 PM
  2. [SOLVED] Copy selected range of data and paste in new open workbook
    By coach.32 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-26-2013, 03:41 AM
  3. [SOLVED] Wanna make a Userform Close and Save - Then open a different workbook?
    By Wanting2Excel in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-06-2012, 08:29 PM
  4. [SOLVED] Export to open .csv file a selected cell range conditioned on a true/false in same row
    By BigAl_Qld in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-20-2012, 07:31 PM
  5. [SOLVED] Open form if cell in a range is selected
    By Marco-Kun in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-24-2012, 04:08 PM

Tags for this Thread

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