View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Sworkhard Sworkhard is offline
external usenet poster
 
Posts: 11
Default Runtime Error 1004 - Method Range of '_Global failed'

actually, it is supposed to refer to the active sheet as whether or not the code proceeds depends on whether or not that cell has "Contract" or "Extra" or nothing at all in it. The With Worksheets("Customers & Jobs") is used later in the code when it has to find a location and offset it by two columns and get the value from that and then insert it back into the activesheet after looping to find all the places where a certain customer's name is and combining all the different job descriptions to form a list.


"keepITcool" wrote:

on 9-7-2004, Sworkhard supposed :

With Worksheets("Customers & Jobs")
If Cells(7, ActiveCell.Column).Value = "Extra" Then


Cells on the last line is referring the the active sheet NOT (as you
probably intended)
to the cells of worksheet C&J because the . is missing before the
..Cells on the 2nd line

Worksheets("y").activate

With Worksheets("x")
'with a dot it will always refer to ws x
..Cells(1,1).value =3
'without the dot is will refer to activesheet in this case y
Cells(1,1).value = 3
end with

HTH,
keepITccol

--
This is an automatic signature of MesNews.
Site : http://mesnews.no-ip.com