VB Password Issue

gmazza76

Well-known Member
Joined
Mar 19, 2011
Messages
771
Office Version
  1. 365
Platform
  1. Windows
Afternoon,

I have been having issues with loading a password into a userform. And i am wondering where below i am asking the VB to match a value in combobox1 if it can be more than 1 option.

With this i mean i have 30 managers who have 3 people working issues they have. Is there anyway i can write the following

If UserForm2.ComboBox1 = "Manager1", "Manager2", "Manager 3" etc..
If it doesnt match the first set it looks at the next set of names. I think i may need to create a loop for the 3 sets but i am unsure of how to do this.

All help appreciated
Cheers:)

Code:
Dim gotcha As Boolean
Dim iRow As Long
Dim ws As Worksheet
Dim lRow As Integer
Dim Pword
Dim cell As Range
Dim I As Long
Set myBook = Workbooks.Open(Filename:="C:\Users\MAZZA\Documents\Gavin\Car Park\FYvData.xls")     'Home
  
    Set ws = myBook.Worksheets("Sheet1")
    If UserForm2.ComboBox1 = "Laura Haynes" Then
        Pword = InputBox("Please enter password")
        If Pword = "ticket" Then
            ActiveWorkbook.Sheets("Sheet1").Activate
        Else
            MsgBox "Please contact your administrator for a password"
            myBook.Close True
            Exit Sub
        End If
    End If
    Unload Me
 
Gavin

I'm just about to shoot of but I what I think you want to do should be straightforward and require no looping.

I don't understand the bit about deleting the row, which row exactly?

Also if all you want to do is delete a row of data why do you need to populate a userform with the values from the row?
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Afternoon,

I need to delete the line of data as follows.

It is pulled from "sheet1" to fill the userform that i complete. when it is completed via the complete button it then uses a specific cell to identify which department it should be registered under. So when the next person comes to complete complete any other problems for that manager it would re load an old enquiry if it wasnt deleted.

ie. "Sheet1" New enquiry.
When completed it would then be raised as complete and registered under another sheet within the same workbook. "Department 1", "Derpartment 2" etc..

The only way i can think of making things simple would be to delete the orginal line out of "Sheet1".

Cheers
Gavin
 
Upvote 0
Could you not just add some sort of flag to the row/record to indicate it's completed?

Then when you come to populate the userform you can skip the completed records.

Anyway, I'll send you a PM later if you want me to take a look at the file(s).
 
Upvote 0
Please i would be grateful.

The reason i want to delete the record is also as i will be running another userform telling people what is open etc..
I was thinking of running this with a listbox using data off "Sheet1" probably using countifs off the the sheet.

Gavin
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top