Run-time error '381' Could not get the List Property.Invalid property array index

04011988

New Member
Joined
Sep 23, 2018
Messages
26
Hi, I am trying to work on macro for a leave application module but that error pop out. I hope you could help me. Thanks in advance. Here is my code:
Code:
Private Sub ComboBox1_Change()

Sheet3.Activate

Dim mytext As Long

mytext = Me.ComboBox1.List(Me.ComboBox1.ListIndex)
TextBox1.Text = Application.WorksheetFunction.VLookup(mytext, Range("A1:E69"), 2, 0)
TextBox2.Text = Application.WorksheetFunction.VLookup(mytext, Range("A1:E69"), 3, 0)
TextBox3.Text = Application.WorksheetFunction.VLookup(mytext, Range("A1:E69"), 4, 0)


End Sub

Private Sub cmdSave_Click()

Sheet4.Activate

If Range("A2") <> "" Then
Rows("2:2").Select
Selection.Insert Shift:=xlDown
End If

If Range("A2") = "" Then
Range("A2") = Me.ComboBox1.Value
Range("B2") = Me.TextBox1.Value
Range("C2") = CDate(Me.TextBox4)
Range("D2") = Me.TextBox2.Value
Range("E2") = Me.TextBox6.Value
Range("F2") = CDate(Me.txtStartDate)
Range("G2") = CDate(Me.txtEndDate)
Range("H2") = Me.ComboBox4.Value
Range("I2") = Me.TextBox5.Value
Range("J2") = Me.TextBox3.Value
End If

Me.ComboBox1.Value = ""
Me.TextBox1.Value = ""
Me.TextBox4.Value = ""
Me.TextBox2.Value = ""
Me.TextBox6.Value = ""
Me.txtStartDate.Value = ""
Me.ComboBox4.Value = ""
Me.TextBox5.Value = ""
Me.TextBox3.Value = ""


Range("L1").Select

End Sub

Private Sub cmdClose_Click()

Unload Me

End Sub

Private Sub cmdReset_Click()

TextBox1.Value = ""
TextBox4 = ""
TextBox2 = ""
TextBox6 = ""
ComboBox4 = ""
TextBox5 = ""
TextBox3 = ""

End Sub


Private Sub UserForm_Click()

TextBox4.Text = Format(Now(), "Short Date")

End Sub
 
Last edited by a moderator:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
It shouldn't show an error.
If you look at the VBE there should be a window (usually below the code window) titled "Immediate", if it's not visible Ctrl G should bring it up.
Run the code from post#28 in a regular module & then copy the details from the immediate window to the thread.
 
Upvote 0
It shouldn't show an error.
If you look at the VBE there should be a window (usually below the code window) titled "Immediate", if it's not visible Ctrl G should bring it up.
Run the code from post#28 in a regular module & then copy the details from the immediate window to the thread.

Sorry. Now get what you mean. Not an expert and thank you for the patience of assisting me.

it says there this one:

|LookUpList| Sheet3 True
 
Upvote 0
Ok, that looks fine. What happens if you make the change in red
Code:
Private Sub cmdEmpID_[COLOR=#ff0000]Click[/COLOR]()

Sheet3.Activate

Dim mytext As Long
mytext = val(Me.cmdEmpID.Text)

TextBox1.Text = Application.WorksheetFunction.vlookup(mytext, Range("A1:E69"), 2, 0)
TextBox2.Text = Application.WorksheetFunction.vlookup(mytext, Range("A1:E69"), 3, 0)
TextBox3.Text = Application.WorksheetFunction.vlookup(mytext, Range("A1:E69"), 4, 0)


End Sub
 
Upvote 0
Thank you Dave. I really appreciate your help. And prioritize granddad duties hahaha..mine can wait. hahahaha. thank you really.

welcome - looks like Fluff has it covered. Would be helpful if you could place copy of your workbook in a dropbox & post link to it here. This will take a lot of the guess work out what to solving your problem.

Dave
 
Upvote 0
Ok, that looks fine. What happens if you make the change in red
Code:
Private Sub cmdEmpID_[COLOR=#ff0000]Click[/COLOR]()

Sheet3.Activate

Dim mytext As Long
mytext = val(Me.cmdEmpID.Text)

TextBox1.Text = Application.WorksheetFunction.vlookup(mytext, Range("A1:E69"), 2, 0)
TextBox2.Text = Application.WorksheetFunction.vlookup(mytext, Range("A1:E69"), 3, 0)
TextBox3.Text = Application.WorksheetFunction.vlookup(mytext, Range("A1:E69"), 4, 0)


End Sub

Hi Fluff, thank you. Yes it is working already. I will try the rest of my other command codes now as there are other command codes I need to add like from the tab where my entries has been populated, it should also populate to an excel template that must be send thru email.

Thank you so much.

I have another question later on what code to use for another macro I am working on as I can't seem to find in youtube. For that question, should I create another post? thank you Fluff and Dave. I really appreciate your help.
 
Upvote 0
Glad we could help & thanks for the feedback.

For that question, should I create another post?
Yes please.
 
Upvote 0
Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.
I have therefore removed the question from post#38 above
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

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