scroll to catagory by listbox item selection

S

Sam

Need som help please.....

This is a macro that runs from the "OnAction" of a commandbar listbox.


Sub Catagory_Select()
Dim cbcCommandBarListBox As CommandBarControl
Set cbcCommandBarListBox = CommandBars("Product Sales Form "). _
FindControl(Tag:="Catagory")

If Not cbcCommandBarListBox Is Nothing Then
MsgBox "You Selected " & cbcCommandBarListBox. _
List(cbcCommandBarListBox.ListIndex)
End If

*********************************************************

How can I replace the messagebox statement with one that scrolls to
the catagories by clicking an item (catagory name) in the
commandbar/listbox? The catagory rows are listed below in the code
from an old command button.


Case "Category Name 1"
Range("F53").Select
ActiveWindow.ScrollRow = ActiveCell.Row
Case " Category Name2 "
Range("F83").Select
ActiveWindow.ScrollRow = ActiveCell.Row
Case " Category Name3 "
Range("F160").Select
ActiveWindow.ScrollRow = ActiveCell.Row
Case " Category Name4 "
Range("F353").Select
ActiveWindow.ScrollRow = ActiveCell.Row
Case " Category Name 5"
Range("F436").Select
ActiveWindow.ScrollRow = ActiveCell.Row
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top