Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default run-time error "381" - Could not set the List Property.

HI All,

Please help. When I have the initial data and then run the script, the new
value gets added to sheet2 correct without error. Then when I run the script
again, I can't get Invest_Results userform to open - keep getting the
following error: "Run-Time error '381': could not set the List Property.
Invalid Property array index.

What am I doing wrong? Below is the copy of my code:

Dim ComplaintRng As Range
Dim StateRng As Range
Dim ErrorRng As Range
Dim ConditionRng As Range
Dim CauseRng As Range
Dim ReplacedRng As Range
Dim AssemblyRng As Range

Option Explicit
'------
'Put information into the cells
Private Sub Submit_button_Click()
Dim InvestStr As String

InvestStr = Me.Complaint_verified + ", " + Me.Failure_state + ", " +
Me.Error_code + ", "
InvestStr = InvestStr + Me.Failure_Condition + ", " + Me.Root_cause + ",
" + Me.Assembly_PN
Stellar_Resolver.Corrections.Value = InvestStr
Stellar_Resolver.Parts_Replaced.Value = Me.PN_Replaced

'ActiveCell = Me.PreviewText
'ActiveCell.Offset(0, 1) = Me.PN_Replaced

'if the entry value is not part of list, add to list
With Worksheets("sheet2")
Set ComplaintRng = .Range("A2", .Cells(.Rows.Count, "A").End(xlUp))
Set StateRng = .Range("B2", .Cells(.Rows.Count, "B").End(xlUp))
Set ErrorRng = .Range("C2", .Cells(.Rows.Count, "C").End(xlUp))
Set ConditionRng = .Range("D2", .Cells(.Rows.Count, "D").End(xlUp))
Set CauseRng = .Range("E2", .Cells(.Rows.Count, "E").End(xlUp))
Set ReplacedRng = .Range("F2", .Cells(.Rows.Count, "F").End(xlUp))
Set AssemblyRng = .Range("G2", .Cells(.Rows.Count, "G").End(xlUp))
End With

If WorksheetFunction.CountIf(ComplaintRng, Me.Complaint_verified.Value)
= 0 Then
Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0) =
Me.Complaint_verified.Value
End If

If WorksheetFunction.CountIf(StateRng, Me.Failure_state.Value) = 0 Then
Sheets("Sheet2").Cells(Rows.Count, 2).End(xlUp).Offset(1, 0) =
Me.Failure_state.Value
End If

If WorksheetFunction.CountIf(ErrorRng, Me.Error_code.Value) = 0 Then
Sheets("Sheet2").Cells(Rows.Count, 3).End(xlUp).Offset(1, 0) =
Me.Error_code.Value
End If

If WorksheetFunction.CountIf(ConditionRng, Me.Failure_Condition.Value) =
0 Then
Sheets("Sheet2").Cells(Rows.Count, 4).End(xlUp).Offset(1, 0) =
Me.Failure_Condition.Value
End If

If WorksheetFunction.CountIf(CauseRng, Me.Root_cause.Value) = 0 Then
Sheets("Sheet2").Cells(Rows.Count, 5).End(xlUp).Offset(1, 0) =
Me.Root_cause.Value
End If

If WorksheetFunction.CountIf(ReplacedRng, Me.PN_Replaced.Value) = 0 Then
Sheets("Sheet2").Cells(Rows.Count, 6).End(xlUp).Offset(1, 0) =
Me.PN_Replaced.Value
End If

If WorksheetFunction.CountIf(AssemblyRng, Me.Assembly_PN.Value) = 0 Then
Sheets("Sheet2").Cells(Rows.Count, 7).End(xlUp).Offset(1, 0) =
Me.Assembly_PN.Value
End If

Unload Me
End Sub

'-------------
'Getting the list from sheet2 to populate drop-down menus
Private Sub UserForm_Initialize()

With Worksheets("Sheet2")
Set ComplaintRng = .Range("A2", .Cells(.Rows.Count, 1).End(xlUp))
Set StateRng = .Range("B2", .Cells(.Rows.Count, 2).End(xlUp))
Set ErrorRng = .Range("C2", .Cells(.Rows.Count, 3).End(xlUp))
Set ConditionRng = .Range("D2", .Cells(.Rows.Count, 4).End(xlUp))
Set CauseRng = .Range("E2", .Cells(.Rows.Count, 5).End(xlUp))
Set ReplacedRng = .Range("F2", .Cells(.Rows.Count, 6).End(xlUp))
Set AssemblyRng = .Range("G2", .Cells(.Rows.Count, 7).End(xlUp))
End With

'using the entire range of values in the column A starting with A2
Me.Complaint_verified.List = ComplaintRng.Value
Me.Failure_state.List = StateRng.Value
Me.Error_code.List = ErrorRng.Value
Me.Failure_Condition.List = ConditionRng.Value
Me.Root_cause.List = CauseRng.Value
Me.PN_Replaced.List = ReplacedRng.Value
Me.Assembly_PN.List = AssemblyRng.Value

End Sub

thanks so much!
--
Learning
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default run-time error "381" - Could not set the List Property.

i figured out how to make the list storage smaller.
--
Learning


"tracktraining" wrote:

HI All,

Please help. When I have the initial data and then run the script, the new
value gets added to sheet2 correct without error. Then when I run the script
again, I can't get Invest_Results userform to open - keep getting the
following error: "Run-Time error '381': could not set the List Property.
Invalid Property array index.

What am I doing wrong? Below is the copy of my code:

Dim ComplaintRng As Range
Dim StateRng As Range
Dim ErrorRng As Range
Dim ConditionRng As Range
Dim CauseRng As Range
Dim ReplacedRng As Range
Dim AssemblyRng As Range

Option Explicit
'------
'Put information into the cells
Private Sub Submit_button_Click()
Dim InvestStr As String

InvestStr = Me.Complaint_verified + ", " + Me.Failure_state + ", " +
Me.Error_code + ", "
InvestStr = InvestStr + Me.Failure_Condition + ", " + Me.Root_cause + ",
" + Me.Assembly_PN
Stellar_Resolver.Corrections.Value = InvestStr
Stellar_Resolver.Parts_Replaced.Value = Me.PN_Replaced

'ActiveCell = Me.PreviewText
'ActiveCell.Offset(0, 1) = Me.PN_Replaced

'if the entry value is not part of list, add to list
With Worksheets("sheet2")
Set ComplaintRng = .Range("A2", .Cells(.Rows.Count, "A").End(xlUp))
Set StateRng = .Range("B2", .Cells(.Rows.Count, "B").End(xlUp))
Set ErrorRng = .Range("C2", .Cells(.Rows.Count, "C").End(xlUp))
Set ConditionRng = .Range("D2", .Cells(.Rows.Count, "D").End(xlUp))
Set CauseRng = .Range("E2", .Cells(.Rows.Count, "E").End(xlUp))
Set ReplacedRng = .Range("F2", .Cells(.Rows.Count, "F").End(xlUp))
Set AssemblyRng = .Range("G2", .Cells(.Rows.Count, "G").End(xlUp))
End With

If WorksheetFunction.CountIf(ComplaintRng, Me.Complaint_verified.Value)
= 0 Then
Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0) =
Me.Complaint_verified.Value
End If

If WorksheetFunction.CountIf(StateRng, Me.Failure_state.Value) = 0 Then
Sheets("Sheet2").Cells(Rows.Count, 2).End(xlUp).Offset(1, 0) =
Me.Failure_state.Value
End If

If WorksheetFunction.CountIf(ErrorRng, Me.Error_code.Value) = 0 Then
Sheets("Sheet2").Cells(Rows.Count, 3).End(xlUp).Offset(1, 0) =
Me.Error_code.Value
End If

If WorksheetFunction.CountIf(ConditionRng, Me.Failure_Condition.Value) =
0 Then
Sheets("Sheet2").Cells(Rows.Count, 4).End(xlUp).Offset(1, 0) =
Me.Failure_Condition.Value
End If

If WorksheetFunction.CountIf(CauseRng, Me.Root_cause.Value) = 0 Then
Sheets("Sheet2").Cells(Rows.Count, 5).End(xlUp).Offset(1, 0) =
Me.Root_cause.Value
End If

If WorksheetFunction.CountIf(ReplacedRng, Me.PN_Replaced.Value) = 0 Then
Sheets("Sheet2").Cells(Rows.Count, 6).End(xlUp).Offset(1, 0) =
Me.PN_Replaced.Value
End If

If WorksheetFunction.CountIf(AssemblyRng, Me.Assembly_PN.Value) = 0 Then
Sheets("Sheet2").Cells(Rows.Count, 7).End(xlUp).Offset(1, 0) =
Me.Assembly_PN.Value
End If

Unload Me
End Sub

'-------------
'Getting the list from sheet2 to populate drop-down menus
Private Sub UserForm_Initialize()

With Worksheets("Sheet2")
Set ComplaintRng = .Range("A2", .Cells(.Rows.Count, 1).End(xlUp))
Set StateRng = .Range("B2", .Cells(.Rows.Count, 2).End(xlUp))
Set ErrorRng = .Range("C2", .Cells(.Rows.Count, 3).End(xlUp))
Set ConditionRng = .Range("D2", .Cells(.Rows.Count, 4).End(xlUp))
Set CauseRng = .Range("E2", .Cells(.Rows.Count, 5).End(xlUp))
Set ReplacedRng = .Range("F2", .Cells(.Rows.Count, 6).End(xlUp))
Set AssemblyRng = .Range("G2", .Cells(.Rows.Count, 7).End(xlUp))
End With

'using the entire range of values in the column A starting with A2
Me.Complaint_verified.List = ComplaintRng.Value
Me.Failure_state.List = StateRng.Value
Me.Error_code.List = ErrorRng.Value
Me.Failure_Condition.List = ConditionRng.Value
Me.Root_cause.List = CauseRng.Value
Me.PN_Replaced.List = ReplacedRng.Value
Me.Assembly_PN.List = AssemblyRng.Value

End Sub

thanks so much!
--
Learning

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Unable to get Pivot Tables Property of Worksheet Class "Error [email protected] Excel Programming 2 April 30th 07 06:18 PM
Hiding Rows Error - "Runtime Error 1004 - Unable to set the hidden property of the range class" Punsterr Excel Programming 2 April 9th 07 05:32 PM
When Using Format(Now(), "yyyymmmddhhmm") get wrong number of arguments or invalid property assignment Error Connie Excel Programming 2 November 8th 06 08:30 AM
cannot use "Create List" and "Share Workbook" same time Devendra Excel Discussion (Misc queries) 0 October 26th 06 06:05 AM
Run time error 1004: "No list was found.." hachiroku[_5_] Excel Programming 1 May 22nd 06 12:53 PM


All times are GMT +1. The time now is 05:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"