Length of Used Column

  • Thread starter Thread starter Alec
  • Start date Start date
A

Alec

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
 
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
 
Thanks Tom
That routine works great.


-----Original Message-----
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




.
 
Back
Top