ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting listbox items programmatically by using stored parameter (https://www.excelbanter.com/excel-programming/391931-selecting-listbox-items-programmatically-using-stored-parameter.html)

JimRWR

Selecting listbox items programmatically by using stored parameter
 
Hi.

My application needs to be able to recall reports defined and saved by the
user (so he doesn't have to go back to the form and make selections all over
again). The save module works fine. However, when I try to select listbox
items based on those selected by the user, I get an error (and no items get
selected). Here's the relevant code, the purpose of which is to take the
value in the activecell, find it in the listbox and select it in the listbox.

For j = 0 To frmGraphingCenter.lbxSummaryMeasure.ListCount - 1
For k = 0 To TitleRec - 1
If ActiveCell.Offset(k, 0).Value < Empty Then
If ActiveCell.Offset(k, 0).Value =
frmGraphingCenter.lbxSummaryMeasure.List(j) Then
frmGraphingCenter.lbxSummaryMeasure.List(j).Select ed = True
End If
End If
Next
Next

Line six causes the 'Object Required' error. Any ideas?

Thanks!



JimRWR

Selecting listbox items programmatically by using stored parameter
 
Never mind! Solved the problem.

"JimRWR" wrote:

Hi.

My application needs to be able to recall reports defined and saved by the
user (so he doesn't have to go back to the form and make selections all over
again). The save module works fine. However, when I try to select listbox
items based on those selected by the user, I get an error (and no items get
selected). Here's the relevant code, the purpose of which is to take the
value in the activecell, find it in the listbox and select it in the listbox.

For j = 0 To frmGraphingCenter.lbxSummaryMeasure.ListCount - 1
For k = 0 To TitleRec - 1
If ActiveCell.Offset(k, 0).Value < Empty Then
If ActiveCell.Offset(k, 0).Value =
frmGraphingCenter.lbxSummaryMeasure.List(j) Then
frmGraphingCenter.lbxSummaryMeasure.List(j).Select ed = True
End If
End If
Next
Next

Line six causes the 'Object Required' error. Any ideas?

Thanks!




All times are GMT +1. The time now is 12:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com