View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Length of Used Column

That never works because the syntax is incorrect

Sub Tester9()
h = Range("C65536").End(xlUp).Row
Range("B1") = 1
Range("B2") = 2
Range("B1:B2").AutoFill _
Destination:=Range("B1:B" & h), _
Type:=xlFillDefault

End Sub

--
Regards,
Tom Ogilvy

"Alec" wrote in message
...
Can anyone tell me why the following sometimes works,
depending on cell contents.

Range("A6").Value = Range(Range("C1").End(xlDown)).Row

For a used range, eg "C1:C36" I want to put the values 1
to 36 in the range "B1:B36" automatically, for this I need
to find the last used cell, eg "C36". The range length
varies, hence the use of the above function.

Thanks
Alec