sweetness34
Board Regular
- Joined
- Jun 23, 2011
- Messages
- 70
Hey guys, I got a few lines of code that work pretty well with one small problem. What I'm doing is searching my spreadsheet for "apples" (now I know apples is not in my data but I need the computer to understand that its ok if its not) but, correct me if I'm wrong. what I think it's doing is since it's not there it's giving me an error because im telling it to select something that is not existant. Now what can I change the .Select to in order for it to search but not try and select since its not there?
heres my code
Thanks
heres my code
Code:
Sheets("data").Select
If Cells.Find(What:="apples", SearchDirection:=xlNext, LookAt:=xlWhole).[COLOR=red]Select[/COLOR] Then
Cells.Find(What:="apples", After:=Range("A1"), SearchDirection:=xlPrevious).Select
z2 = Selection.Offset(1, 6).Address
Range(z2).Select
Selection.copy
Sheets("Report").Select
Range("B5").Select
Selection.PasteSpecial paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Else
End If
Thanks