LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Report Post  
Posted to microsoft.public.excel.programming
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

 
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
Need to bold a cell based on keyword in another cell... Max Excel Discussion (Misc queries) 3 February 17th 10 09:46 PM
Populate cells based on key cell Banshee[_2_] Excel Discussion (Misc queries) 4 September 8th 09 04:49 PM
auto populate cell based on previous cell drop down list selectio. PuzzledbyLists Excel Discussion (Misc queries) 2 September 11th 06 01:28 AM
Insert text in Cell A1 based on keyword criteria [email protected] Charts and Charting in Excel 1 June 13th 06 04:56 PM
Loop to change cell color based on found value? gaba Excel Programming 3 November 3rd 04 02:33 PM


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