Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default validating 4 values programatically

Hi, Using XL 2000

My worksheet contains numerical values in Cols A, B, C & D.
Cols E & F Contain Contact Names. There are over 100 rows of data

In my userform, a user selects a numerical value in Combobox1 and combobox2

On a click event, I would like the following to execute:-

The value selected in CB1 is checked against every row and where it is
greater than value in Col A AND less than the value in Col B, reports True

The value selected in CB2 is checked against every row and where it is
greater than value in Col C AND less than the value in Col D, reports True

Only where 2 True's are present, I need the values in Cols e & F in the
respective row that meets the true condition to be added to ListBox1.

I hope i've manged to explain my problem.
Any VBA ideas welcome.

Thank you.

Paul

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default validating 4 values programatically

Dim cell as Range
for each cell in Range("A1:A100)
if cdbl(cb1.value) = cell and cdbl(cb1.value) <= cell(1,2) _
and cdbl(cb2.value) = cell(1,3) and cdbl(cb2.value) <= _
cell(1,4) then
listbox1.AddItem cell(1,5)
listbox1.list(listbox1.listcount-1,1) = cell(1,6)
end if
Next

--
Regards,
Tom Ogilvy


"Paulc" wrote in message
...
Hi, Using XL 2000

My worksheet contains numerical values in Cols A, B, C & D.
Cols E & F Contain Contact Names. There are over 100 rows of data

In my userform, a user selects a numerical value in Combobox1 and

combobox2

On a click event, I would like the following to execute:-

The value selected in CB1 is checked against every row and where it is
greater than value in Col A AND less than the value in Col B, reports True

The value selected in CB2 is checked against every row and where it is
greater than value in Col C AND less than the value in Col D, reports True

Only where 2 True's are present, I need the values in Cols e & F in the
respective row that meets the true condition to be added to ListBox1.

I hope i've manged to explain my problem.
Any VBA ideas welcome.

Thank you.

Paul



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default validating 4 values programatically

Hi, this CountData is a gem that Tom posted in many other posts. This
will check against all of the values in column A.

Dim cell as Range
Dim CountData&
CountData = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
for each cell in Range("A1:A" & CountData)
if cdbl(cb1.value) = cell and cdbl(cb1.value) <= cell(1,2) _
and cdbl(cb2.value) = cell(1,3) and cdbl(cb2.value) <= _
cell(1,4) then
listbox1.AddItem cell(1,5)
listbox1.list(listbox1.listcount-1,1) = cell(1,6)
end if
Next

Tom, you are the man. I learn something new from all of your posts.
Lonnie M.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default validating 4 values programatically

Many thanks tom.
Perfection as usual!

Regards,
Paul

"Tom Ogilvy" wrote:

Dim cell as Range
for each cell in Range("A1:A100)
if cdbl(cb1.value) = cell and cdbl(cb1.value) <= cell(1,2) _
and cdbl(cb2.value) = cell(1,3) and cdbl(cb2.value) <= _
cell(1,4) then
listbox1.AddItem cell(1,5)
listbox1.list(listbox1.listcount-1,1) = cell(1,6)
end if
Next

--
Regards,
Tom Ogilvy


"Paulc" wrote in message
...
Hi, Using XL 2000

My worksheet contains numerical values in Cols A, B, C & D.
Cols E & F Contain Contact Names. There are over 100 rows of data

In my userform, a user selects a numerical value in Combobox1 and

combobox2

On a click event, I would like the following to execute:-

The value selected in CB1 is checked against every row and where it is
greater than value in Col A AND less than the value in Col B, reports True

The value selected in CB2 is checked against every row and where it is
greater than value in Col C AND less than the value in Col D, reports True

Only where 2 True's are present, I need the values in Cols e & F in the
respective row that meets the true condition to be added to ListBox1.

I hope i've manged to explain my problem.
Any VBA ideas welcome.

Thank you.

Paul




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
validating Philashley Excel Discussion (Misc queries) 2 March 13th 08 03:54 PM
Validating Values Within Sets of Groups in a Column ConfusedNHouston Excel Discussion (Misc queries) 0 March 10th 08 04:17 PM
validating cells in the same row has unique values Volkan Akyuz Excel Worksheet Functions 2 August 22nd 06 11:01 AM
validating Ayesha Excel Worksheet Functions 2 April 26th 06 02:56 PM
Validating Sdbenn90 Excel Discussion (Misc queries) 0 March 27th 06 12:05 AM


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