Macro dosn't recognize the value in a cell?


Posted by Paul Magruder on June 26, 2001 11:44 AM

Having trouble with the macro recognizing the value in column "N" (ins). If I check the code, it knows the value from the inputbox, but won't recognize the number when searching column "N". I have tried formatting as Text and Number....If I retype the number in "N" it sees it.....If I bring it in using copy / paste it dosn't see it...any Suggestions?

Sheets("By Shift").Select
Range("n6").Select
ins = InputBox("Insurance Number?")
Range("N2") = ins
Sheets("People").Select
Range("a2") = ins
Sheets("By Shift").Select
Range("n5").Select
Do Until ActiveCell = "xxx"
If ActiveCell = ins Then

Selection.EntireRow.Copy
ActiveCell.Offset(1, 0).Select
Sheets("People").Select
Range("a5").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Selection.Value = Selection.Value
End If
ActiveCell.Offset(1, 0).Select
Sheets("By Shift").Select
Application.CutCopyMode = False
loop
end sub

Thanks
Paul

Posted by Russell on June 26, 2001 11:54 AM

If ins is a number (integer) you can try this:

If ActiveCell.Value = int(ins) then
....

(The value you read in from the InputBox comes in as text).

You could also do this:

If ActiveCell.Text = ins then
.....

Hope this helps,

Russell



Posted by Paul Magruder on June 27, 2001 7:07 AM

Thanks......Works Great!

Thanks!