Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Use ListBox properties in This Workbook


Hi guys,

Can anyone help me please. I have a small problem :

I'm trying to use ListCount property of an ListBox in This Workboo
object of the workbook and I get run-time error '424' Object requierd.
The script is the following:

Private Sub workbook_open()

Dim d3 As Integer
Dim d4 As Integer
d3 = ListBox1.ListCount - 1


For d4 = 0 To d3
With Sheets("WERA Scorecard").Range("B35:B100")
Set D = .Find(ListBox1.List(d4), LookIn:=xlValues
LookAt:=xlWhole)
If Not D Is Nothing Then
ListBox1.Selected(d4) = True
Else
End If
End With
Next d4

End Sub


I'm not a programmer so I just read help and try to figure it out bu
this time I didn't manage to find the solution.

I would be really happy if somebody can help me with this issue.

Thanks

--
cristio2
-----------------------------------------------------------------------
cristio26's Profile: http://www.excelforum.com/member.php...fo&userid=1551
View this thread: http://www.excelforum.com/showthread.php?threadid=27082

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Use ListBox properties in This Workbook

Put your code in a general module and call it from the Workbook_Open Event

Sub ProcessListbox()
Dim d3 As Integer
Dim d4 As Integer
Sheets("WERA Scorecard").Activate
d3 = ListBox1.ListCount - 1

For d4 = 0 To d3
With Sheets("WERA Scorecard").Range("B35:B100")
Set D = .Find( Sheets("WERA Scorecard"). _
ListBox1.List(d4), LookIn:=xlValues, _
LookAt:=xlWhole)
If Not D Is Nothing Then
Sheets("WERA Scorecard").ListBox1.Selected(d4) = True
End If
End With
Next d4

End Sub

Private Sub Workbooks_Open()
ProcessListBox
End sub

--
Regards,
Tom Ogilvy


"cristio26" wrote in message
...

Hi guys,

Can anyone help me please. I have a small problem :

I'm trying to use ListCount property of an ListBox in This Workboox
object of the workbook and I get run-time error '424' Object requierd.
The script is the following:

Private Sub workbook_open()

Dim d3 As Integer
Dim d4 As Integer
d3 = ListBox1.ListCount - 1


For d4 = 0 To d3
With Sheets("WERA Scorecard").Range("B35:B100")
Set D = .Find(ListBox1.List(d4), LookIn:=xlValues,
LookAt:=xlWhole)
If Not D Is Nothing Then
ListBox1.Selected(d4) = True
Else
End If
End With
Next d4

End Sub


I'm not a programmer so I just read help and try to figure it out but
this time I didn't manage to find the solution.

I would be really happy if somebody can help me with this issue.

Thanks!


--
cristio26
------------------------------------------------------------------------
cristio26's Profile:

http://www.excelforum.com/member.php...o&userid=15510
View this thread: http://www.excelforum.com/showthread...hreadid=270823



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
XL Workbook Properties chrisan Excel Discussion (Misc queries) 1 September 5th 05 04:41 PM
LISTBOX PROPERTIES browie Excel Discussion (Misc queries) 1 August 22nd 05 04:08 PM
Workbook Properties KC8DCN Excel Discussion (Misc queries) 1 June 8th 05 06:34 PM
Listbox Properties totally blank Michael Singmin Excel Programming 0 September 28th 04 08:45 PM
Control Toolbox ListBox Properties Blank pjhageman[_12_] Excel Programming 2 January 12th 04 03:51 PM


All times are GMT +1. The time now is 07:55 AM.

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"