Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
URGENT HELP PLZ! Search and Update VBA function.
Dash wrote:
Hi all! I've been trying to make a function where the code searches an entire column for a value given by a cell (range). Example: Worksheet1, CELL B11 has value 809 Search worksheet2 cells A:A for value in worksheet1,cell B11 (in this case, 809) If that value is found, then update Column G in that row with the value of worksheet1 Cell P2 Else, appear a msgbox saying ERROR! Dash, I'm not sure how the code you posted related to your question, but the following does what you've described in your post. HTH, post back if not. Nik Sub NikTest() Dim Target_Value Dim NikCell As Range Dim Any_Yet As Boolean Target_Value = Sheet1.Range("b11").Value Any_Yet = False For Each NikCell In Intersect(Sheet2.UsedRange, Sheet2.Range("a:a")).Cells With NikCell If .Value = Target_Value Then .Offset(0, 6) = Sheet1.Range("p2") Any_Yet = True End If End With Next If Any_Yet = False Then MsgBox ("Didn't find any") End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Very Urgent - Find / Search Help Needed | Excel Discussion (Misc queries) | |||
Cells won't automatically update --- urgent! | Excel Discussion (Misc queries) | |||
Excel selective search for a combination of values - urgent | Excel Programming | |||
URGENT: Search for text in column and count by month | Excel Discussion (Misc queries) | |||
Google Search Add-in update | Excel Worksheet Functions |