Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default How to program this?


I am new to excel programming and am not able to get it to work.
Can someone help me with this?
How can I Compare the text values in cell A and B and populate cell C
accordingly?

A is a dropdown with following values
compile, edit, audit

B is a dropdown and has the same values as A
compile, edit, audit

C is a text box that auto populates with 'Descripency' depending on what is
selected for A and B.

What I am thinking should be done is:
Compare the text strings in A and B using StrComp() function,
It will return a value -1,0,1
Then write an If statement to populate the value in C.

But, How does excel compare the text values in A and B?
For eg, I want Discrepancy to be populated in C if audit is selected in B
and edit is selected in A. How will excel know this? I cannot manualy write
down what text value preeceds what as there are a LOT of values.

I hope I made it clear.

Thanks in Advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default How to program this?

I am probably confused as to what you want, but is this what you're
looking for---put the following in as a formula in column C:
=IF(A1=B1,"","Discrepancy")
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default How to program this?


Sam
I think you are making this overly complicated, or I'm missing
something. Use something like this:
If Range("A1")="edit" and Range("B1")="audit" then Range("C1")="Discrepancy"
You will need more code if you want to loop through a range or if you want
to employ an event occurrence.
Provide more detail about what you have and what you want to do. HTH Otto
"sam" wrote in message
...
I am new to excel programming and am not able to get it to work.
Can someone help me with this?
How can I Compare the text values in cell A and B and populate cell C
accordingly?

A is a dropdown with following values
compile, edit, audit

B is a dropdown and has the same values as A
compile, edit, audit

C is a text box that auto populates with 'Descripency' depending on what
is
selected for A and B.

What I am thinking should be done is:
Compare the text strings in A and B using StrComp() function,
It will return a value -1,0,1
Then write an If statement to populate the value in C.

But, How does excel compare the text values in A and B?
For eg, I want Discrepancy to be populated in C if audit is selected in B
and edit is selected in A. How will excel know this? I cannot manualy
write
down what text value preeceds what as there are a LOT of values.

I hope I made it clear.

Thanks in Advance



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 207
Default How to program this?


Sam,
You could try this:
In Cell C2 type "=If(A2=B2,"Yes","Discrepency")" without the "".
What this does is no matter what is selected in A or B if they don't match,
Discrepency.
hth

"sam" wrote:

I am new to excel programming and am not able to get it to work.
Can someone help me with this?
How can I Compare the text values in cell A and B and populate cell C
accordingly?

A is a dropdown with following values
compile, edit, audit

B is a dropdown and has the same values as A
compile, edit, audit

C is a text box that auto populates with 'Descripency' depending on what is
selected for A and B.

What I am thinking should be done is:
Compare the text strings in A and B using StrComp() function,
It will return a value -1,0,1
Then write an If statement to populate the value in C.

But, How does excel compare the text values in A and B?
For eg, I want Discrepancy to be populated in C if audit is selected in B
and edit is selected in A. How will excel know this? I cannot manualy write
down what text value preeceds what as there are a LOT of values.

I hope I made it clear.

Thanks in Advance

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 199
Default How to program this?


If you have dropdown A ,B and textBox C in Userform, try something like
this. This code should be written in Userform module.
ComboBox1 means dropdown A, ComboBox2 means dropdown B and textBox C
means TextBox1.

Private Sub ComboBox1_Change()
If ComboBox1.Value < ComboBox2.Value Then
Me.TextBox1.Text = "Discrepancy"
Else
Me.TextBox1.Text = ""
End If
End Sub

Private Sub ComboBox2_Change()
If ComboBox1.Value < ComboBox2.Value Then
Me.TextBox1.Text = "Discrepancy"
Else
Me.TextBox1.Text = ""
End If
End Sub

Keiji

sam wrote:
I am new to excel programming and am not able to get it to work.
Can someone help me with this?
How can I Compare the text values in cell A and B and populate cell C
accordingly?

A is a dropdown with following values
compile, edit, audit

B is a dropdown and has the same values as A
compile, edit, audit

C is a text box that auto populates with 'Descripency' depending on what is
selected for A and B.

What I am thinking should be done is:
Compare the text strings in A and B using StrComp() function,
It will return a value -1,0,1
Then write an If statement to populate the value in C.

But, How does excel compare the text values in A and B?
For eg, I want Discrepancy to be populated in C if audit is selected in B
and edit is selected in A. How will excel know this? I cannot manualy write
down what text value preeceds what as there are a LOT of values.

I hope I made it clear.

Thanks in Advance

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
Run a program Johan Excel Programming 1 October 18th 08 09:52 PM
VBA Program Rudy Excel Programming 7 October 12th 08 08:55 PM
Is there a way to unload the loaded XLL file in Excel? Hi all, I amdebugging XLL link library using Visual C++. Everytime I rebuild the XLL, Ihave to close the whole Excel program and relaunch the Excel program again,and then load in the newly gene LunaMoon Excel Discussion (Misc queries) 0 July 28th 08 11:03 PM
merging excel program with tdc finance program judy Excel Programming 0 November 5th 03 08:01 PM


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