ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   List Box with macro (https://www.excelbanter.com/excel-worksheet-functions/74161-list-box-macro.html)

VETcalc

List Box with macro
 

I have 100 clients and store their data on one sheet.


Example: Client A's data would be located at b230:k254.

Client B's data would be located at b260:k284

I would like to develop a List Box that would contain all of my
clients.
Once a client is highlighted, I would like to press enter and have a
macro take me to the selected clients data.

Can someone please point me in the right direction to accomplish this
task.

Thanks,

Bob


--
VETcalc
------------------------------------------------------------------------
VETcalc's Profile: http://www.excelforum.com/member.php...o&userid=13078
View this thread: http://www.excelforum.com/showthread...hreadid=516899


Richard Buttrey

List Box with macro
 
On Mon, 27 Feb 2006 10:14:34 -0600, VETcalc
wrote:


I have 100 clients and store their data on one sheet.


Example: Client A's data would be located at b230:k254.

Client B's data would be located at b260:k284

I would like to develop a List Box that would contain all of my
clients.
Once a client is highlighted, I would like to press enter and have a
macro take me to the selected clients data.

Can someone please point me in the right direction to accomplish this
task.

Thanks,

Bob


Probably several ways, but one that springs to mind is:

Create a unique list of your client names/codes and name the range say
"Clients"

In the RowSource property of the list box, enter the name "Clients"

I'm going to assume here that your data has the client name/code in
column A of sheet1. Change the code as necessary

In say the Click event of the ListBox, enter the following

Private Sub ListBox1_Click()
Dim stMyClient As String

stMyClient = UserForm1.ListBox1
Worksheets("sheet1").Activate
Range("a1").Select
Columns("A:A").Find(What:=stMyClient, After:=ActiveCell).Activate

End Sub

Hope this gives a general idea.





Richard Buttrey
__

VETcalc

List Box with macro
 

Richard,

Thank you!

Bob


--
VETcalc
------------------------------------------------------------------------
VETcalc's Profile: http://www.excelforum.com/member.php...o&userid=13078
View this thread: http://www.excelforum.com/showthread...hreadid=516899



All times are GMT +1. The time now is 07:14 PM.

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