Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
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
Very Urgent - Find / Search Help Needed TGV Excel Discussion (Misc queries) 8 June 28th 09 03:00 PM
Cells won't automatically update --- urgent! Ryan Excel Discussion (Misc queries) 3 July 22nd 08 04:18 PM
Excel selective search for a combination of values - urgent Shashank Excel Programming 0 November 23rd 06 10:26 AM
URGENT: Search for text in column and count by month saras Excel Discussion (Misc queries) 1 April 13th 06 03:00 AM
Google Search Add-in update Ron de Bruin Excel Worksheet Functions 1 November 19th 04 10:54 PM


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