View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Incidental Incidental is offline
external usenet poster
 
Posts: 226
Default Auto Copy from Sheet1 to Sheet2

Hi RyGuy

Your variable "rng" is not declared in your code i.e. Dim rng as
range, also you are trying to loop through "rng" which is not set to
anything i.e. set rng=range("A1:A100")

You then go on to "if i.custlookup" this wont work as you are
effectively saying range.range???

if you are looking for a cell ("i") in the range ("rng") that contains
the same value as the range ("CustLookUp") you could write it as

For Each i In rng
If i.value=custlookup.value then

or if you want the cells that do not hold the same value as custlookup
you could write it as

For Each i In rng '< -- error occurs here
If i.value < custlookup.value then


I hope this helps you out

Steve