View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
ghobbit[_7_] ghobbit[_7_] is offline
external usenet poster
 
Posts: 1
Default Populate a cell based on a keyword it found in another


Hi Ikaabod

Thanks for your reply.

I tried it and nothing happened. I worked my way through the code an
thought would this work instead

Sub Test()
Dim strValue1 As String
Dim strValue2 As String
Dim Criteria1 As String
Dim Criteria2 As String
Dim Criteria3 As String
Dim Criteria4 As String
Criteria1 = "NEG"
Criteria2 = "LG"
Criteria3 = "HGI"
Criteria4 = "HGII"
Criteria5 = "AGUS"

Dim iRow As Integer
Dim iTotalRows As Integer
iRow = 0
iTotalRows = ActiveSheet.UsedRange.Rows.Count
Range("A2").Select
Do
strValue1 = ActiveCell.Offset(iRow, 1).Value
strValue2 = ActiveCell.Offset(iRow, 2).Value
If (strValue1 = Criteria1 And strValue2 = Criteria2) Or (strValue1
Criteria1 And strValue2 = Criteria3) Or (strValue1 = Criteria1 An
strValue2 = Criteria4) Or (strValue1 = Criteria1 And strValue2
Criteria5) Then ActiveCell.Offset(iRow, 3).Value = "FN"
Debug.Print ActiveCell.Offset(iRow, 1).Address
iRow = iRow + 1
Loop Until iRow = iTotalRows


End Sub

It didnt work either - no error messages or anything as on you
original code.

I saw on your code you had used the 'UCase' - probably because I ha
used lowercase before however that was my mistake as 'Neg' is uppercas
anyway. I have added an extra Criteria and called it 'NEG' an
re-written the code slightly which hopefully will show a bit bette
what I'm trying to achieve.

Many thanks

Stev

--
ghobbi
-----------------------------------------------------------------------
ghobbit's Profile: http://www.excelforum.com/member.php...fo&userid=1238
View this thread: http://www.excelforum.com/showthread.php?threadid=54120