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: 27
Default Find and loop help-multiple columns

I an trying to write a macro to search for a cell value in one column and see
if it occurs in other columns

I'm having 2 problems:

1. How can I look from the last used row up to row 4 in "myrange+5" as set
below?

2. How can I look in all other columns beside the "myrange+5" column named
"Route Number(s)"?

Am I completely off track??

With lastperiod

'Find the last used column
myrange = ActiveSheet.UsedRange.Columns.Count
ActiveSheet.Cells(1, myrange + 2).Select

'find the last row
therow = ActiveSheet.Cells.Find(What:="*", SearchDirection:=xlPrevious,
SearchOrder:=xlRows).Row

'paste the info
ActiveSheet.Paste


'start checking for duplicate route numbers
Dim rngToSearch As Range
Dim rngToFind As Range
Dim rngFound As Range
Dim rng As Range
Dim wks As Worksheet


Set rngToSearch = .Range('NEED HELP HERE--myrow+5')
Set rngToFind = .Range('NEED HELP HERE--all other columns with "Route
Number(s)" in Row 2')


For Each rng In rngToSearch
Set rngFound = rngToFind.Find(What:=rng.Value, MatchCase:=False)
If rngFound Is Nothing Then rng.Offset(0, 10).Value = "First Time"
Else rng.Offset(0, 10).Value = "Repeat"

Next rng

End With
 
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
Sum multiple columns; find max Opal Excel Programming 1 June 12th 09 01:03 AM
Doing a LOOP for multiple columns, help please... jhong Excel Programming 3 February 6th 08 01:59 PM
find number in multiple columns and rows JLeoni Excel Worksheet Functions 1 October 25th 06 09:14 PM
find and delete a character from multiple columns scrocker Excel Programming 1 October 11th 06 10:54 PM
Find Values 0 Over Multiple Columns CalumMurdo Kennedy Excel Programming 0 September 18th 03 08:24 AM


All times are GMT +1. The time now is 09:42 PM.

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"