LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default search and offset?

I am trying to search a column in my worksheet, and if that column has a
value that is not 1, then compare it to the cell value in the same row in
column N. If the two cell values are different then put the current
selection in column R. Does that make sense? Here is my code. any help is
appreciated!

Dim wks As Worksheet
Dim rngFound As Range
Set wks = Sheets("exam_am_trades")
Set rngToSearch = Range("p4:p1700")
saddr = ActiveCell.Address
Set rngFound = rngToSearch.Find(what:="1", LookIn:=xlValues,
lookat:=xlWhole)
If rngFound = 1 Then
Set rngFound = rngToSearch.FindNext
Else
If rngFound < saddr.Offset(0, -2) Then
saddr.Offset(0, 2) = saddr.Value
End If
End If
End Sub
 
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
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul RyGuy Excel Worksheet Functions 2 September 28th 07 10:54 PM
search column, hyperlink, offset, substitute, match (omg) nastech Excel Discussion (Misc queries) 13 July 13th 06 09:58 PM
How do I search excel spreadsheets using multiple search criteria. Kasper Excel Worksheet Functions 4 December 15th 05 12:26 AM
Create a search Field within a worksheet to search command buttons Ed P[_2_] Excel Programming 1 December 14th 04 08:04 PM
macro to search and replace with offset Tim Excel Discussion (Misc queries) 5 December 11th 04 09:30 PM


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