Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, Trying to create a macro that will take values in column A on m "audit" sheet and compare them to 'myRng' on the "Rows" sheet returning the value of the column the value is found in. How would implement an if-then statement to keep the macro from erroring when th value is not found in 'myRng'? So far I've come up with: Public Sub test() Dim num As Integer Dim mynum As Range Dim cell As Range Dim column As Integer Worksheets("audit").Select Set mynum = Range(Range("a2"), Range("a2").End(xlDown)) For Each cell In mynum num = cell.Value Worksheets("rows").Activate Cells.Find(num).Activate column = ActiveCell.column Worksheets("audit").Select cell.Offset(0, 1) = column End If End Sub Appreciate the help. Mjac -- mjack00 ----------------------------------------------------------------------- mjack003's Profile: http://www.excelforum.com/member.php...nfo&userid=514 View this thread: http://www.excelforum.com/showthread.php?threadid=46844 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Too Many IF Statements Nesting Error (Excel Formula Loop w/o VBA) | Excel Worksheet Functions | |||
Advancing outer Loop Based on criteria of inner loop | Excel Programming | |||
Loop Function unable to loop | Excel Programming | |||
Problem adding charts using Do-Loop Until loop | Excel Programming | |||
HELP!!!! Can't stop a loop (NOT an infinite loop) | Excel Programming |