Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If Statement


Does anyone have any suggestions to look at column A and:

In column A:
If Cell.Value = "005" Then
Colum B Cell Value="AAA"
In column A:
If Cell.Value = "102" Then
Colum B Cell Value="BBB"
In column A:
If Cell.Value = "109" Then
Colum B Cell Value="CCC"
In column A:
If Cell.Value = "112" Then
Colum B Cell Value="DDD"
In column A:
If Cell.Value = "641" Then
Colum B Cell Value="EEE"
In column A:
If Cell.Value = "2090" Then
Colum B Cell Value="FFF"

Any help would be greatly appreciated!


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=511966

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default If Statement

Try this:

Private Sub Worksheet_Change(ByVal Target As Range)

Dim NewValue As String
If Target.Column = 1 Then
Select Case Target.Text
Case Is = "005", "5"
NewValue = "AAA"
Case Is = "102"
NewValue = "BBB"
Case Is = "109"
NewValue = "CCC"
Case Is = "112"
NewValue = "DDD"
Case Is = "641"
NewValue = "EEE"
Case Is = "2090"
NewValue = "FFF"
End Select
Target.Offset(0, 1) = NewValue
End If

End Sub

This assumes that you want the Triple letters to occurr right next to
your exixting numbers.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If Statement


Thanks Mark, I appreciate your help!

I receive the following error messsage:

Run Time Error 424 - Object required

At this line:

If Target.Column = 1 Then

Any sugestions?

Thank

--
STEVE
-----------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...nfo&userid=187
View this thread: http://www.excelforum.com/showthread.php?threadid=51196

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If Statement


STEVEB Wrote:
Thanks Mark, I appreciate your help!

I receive the following error messsage:

Run Time Error 424 - Object required

At this line:

If Target.Column = 1 Then

Any sugestions?

Thanks


Mark's routine seems to be OK. Just check that you have copied i
correctly. Also I hope the procedure is on the code sheet of you
worksheet. ( Rightclick the worksheet tab and then click 'view code'
Paste the procedure given by Mark on this code sheet.) It should work.

A V Veerka

--
avveerka
-----------------------------------------------------------------------
avveerkar's Profile: http://www.excelforum.com/member.php...fo&userid=3033
View this thread: http://www.excelforum.com/showthread.php?threadid=51196

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If Statement


STEVEB Wrote:
Does anyone have any suggestions to look at column A and:

In column A:
If Cell.Value = "005" Then
Colum B Cell Value="AAA"
In column A:
If Cell.Value = "102" Then
Colum B Cell Value="BBB"
In column A:
If Cell.Value = "109" Then
Colum B Cell Value="CCC"
In column A:
If Cell.Value = "112" Then
Colum B Cell Value="DDD"
In column A:
If Cell.Value = "641" Then
Colum B Cell Value="EEE"
In column A:
If Cell.Value = "2090" Then
Colum B Cell Value="FFF"

Any help would be greatly appreciated!


Instead of VBA you could have a nested IF formula in B1

=IF(A1="005","AAA",IF(A1="102","BBB",IF(A1="109"," CCC",IF(A1="112","DDD",IF(A1="641","EEE",IF(A1="20 90","FFF",""))))))
And then autofill to all the cells (B2 onward) in col B.

I am assuming that col A has text characters not numbers. eg if A1
="102" then B1 = "BBB" asssumes A1 is character string. If it is number
then change formula by removing quotes around A1 value. eg A1=102
instead of A1="102"

A V Veerkar


--
avveerkar
------------------------------------------------------------------------
avveerkar's Profile: http://www.excelforum.com/member.php...o&userid=30338
View this thread: http://www.excelforum.com/showthread...hreadid=511966



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If Statement


A V

Thanks for the suggestion..It worked!!


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=511966

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If Statement


STEVEB Wrote:
A V

Thanks for the suggestion..It worked!!


You are welcome.

A V Veerka

--
avveerka
-----------------------------------------------------------------------
avveerkar's Profile: http://www.excelforum.com/member.php...fo&userid=3033
View this thread: http://www.excelforum.com/showthread.php?threadid=51196

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
IF statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
SUMIF statement with AND statement Eric D Excel Discussion (Misc queries) 2 July 14th 08 07:24 PM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM


All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"