Thread: help
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default help

Hi

Use this

With Worksheets("Mysheet")
Set testrange = .Range(.Cells(3, 8), .Cells(300, 8))
End With

In your code cells use the cells in the activesheet and not in the sheet Mysheet
see the dots before Cells now so it use the cells on the sheet Mysheet

You can also use

Set testrange = Worksheets("Mysheet").Range(Worksheets("Mysheet"). Cells(3, 8), Worksheets("Mysheet").Cells(300, 8))



--
Regards Ron de Bruin
http://www.rondebruin.nl



"jutes.g" wrote in message oups.com...
I'm new to VBA and I can't seem to get this to work:
Set testrange = ActiveWorkbook.Worksheets("Mysheet").Range(Cells(3 , 8),
Cells(300, 8))

it returns a 1004 error..