Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Userform Formula Help Needed

I have a spreadsheet in which Sheet1(X1:X100) contains a list of
unique names. On my Userform I have ComboBox1 and TextBox1. ComboBox1
has it's rowsource as Sheet1(X1:X100). My Data
Sheet2(A2:A500)contains rows of the names inputted from ComboBox1.
I am trying to get TextBox1 on my Userform to count the number of
times the same name occurs in range Sheet2(A2:A500)when a change
occurs in ComboBox1.
What is the Sub formula I can use for this change() event?
Any help is appreciated.
Tim
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Userform Formula Help Needed

Tim,

This should do it

Private Sub ComboBox1_Change()
TextBox1.Text = WorksheetFunction.CountIf(Worksheets("Sheet2"). _
Range("A2:A500"), ComboBox1.Value)
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"timh2ofall" wrote in message
. ..
I have a spreadsheet in which Sheet1(X1:X100) contains a list of
unique names. On my Userform I have ComboBox1 and TextBox1. ComboBox1
has it's rowsource as Sheet1(X1:X100). My Data
Sheet2(A2:A500)contains rows of the names inputted from ComboBox1.
I am trying to get TextBox1 on my Userform to count the number of
times the same name occurs in range Sheet2(A2:A500)when a change
occurs in ComboBox1.
What is the Sub formula I can use for this change() event?
Any help is appreciated.
Tim



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Userform Formula Help Needed

I have a spreadsheet in which Sheet1(X1:X100) contains a list of
unique names. On my Userform I have ComboBox1 and TextBox1. ComboBox1
has it's rowsource as Sheet1(X1:X100). My Data
Sheet2(A2:A500)contains rows of the names inputted from ComboBox1.
I am trying to get TextBox1 on my Userform to count the number of
times the same name occurs in range Sheet2(A2:A500)when a change
occurs in ComboBox1.
What is the Sub formula I can use for this change() event?
Any help is appreciated.


When you change ComboBox1 make sure the change event copies the new name to
a worksheet cell, sheet2(A501). In sheet2(A502) add this:

countif("A2:A500",A501)

Set TextBox1 to display the contents of sheet2(A502)

HTH

Chris


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
needed formula ez3zz Excel Worksheet Functions 1 February 10th 09 05:47 PM
Excel formula to copy/paste formula needed please. colwyn Excel Discussion (Misc queries) 4 October 22nd 08 11:27 PM
Userform button setting variable from formula teepee Excel Discussion (Misc queries) 4 January 4th 06 06:59 PM
Userform button setting variable from formula teepee Excel Discussion (Misc queries) 0 January 3rd 06 08:26 PM
A pointer or two needed using userform Jim[_32_] Excel Programming 1 October 20th 03 06:04 PM


All times are GMT +1. The time now is 10:17 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"