Results 1 to 5 of 5

How to open msgBox and close UserForm if no data found

Threaded View

tuongtu3 How to open msgBox and close... 12-10-2012, 08:56 PM
tuongtu3 Re: How to open msgBox and... 12-11-2012, 02:20 AM
antoka05 Re: How to open msgBox and... 12-11-2012, 04:28 AM
tuongtu3 Re: How to open msgBox and... 12-11-2012, 03:43 PM
antoka05 Re: How to open msgBox and... 12-12-2012, 04:45 AM
  1. #1
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    818

    How to open msgBox and close UserForm if no data found

    Hi all,
    I'm trying to open the workbook base on Cell value and I would like to open MsgBox and close UserForm if the file does not exsit.

    Regards,
    tt3
    Private Sub tt3_Click()
    Sheets("Sheet1").Range("N2").Value = UserForm.TextBox2.Value
    
    If Sheets("Sheet1").Range("N2").Value = False Then
    MsgBox "Please enter Vehicle info"
    UserForm.Hide
    End If
    
    If Not "Y:\Testing\" & ThisWorkbook.Sheets("Sheet1").Range("N2").Value & ".xlsm" Then
    MsgBox " This Vehicle does not exist "
    UserForm.Hide
    End If
    
    Else
    Workbooks.Open Filename:="Y:\Testing\" & ThisWorkbook.Sheets("Sheet1").Range("N2").Value & ".xlsm"
    UserForm.Hide
    
    End Sub
    Last edited by tuongtu3; 12-11-2012 at 03:44 PM. Reason: SOLVED

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