Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Length of Used Column

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Length of Used Column

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

"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



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to have charac in new column with 40 char length only... Rajat[_2_] Excel Discussion (Misc queries) 2 February 24th 10 04:43 PM
Text to column fixed length Luci Excel Discussion (Misc queries) 6 November 27th 08 06:27 PM
automate column length wsk Excel Discussion (Misc queries) 1 May 13th 06 12:31 PM
Sum a Column of Variable length Chris G Excel Discussion (Misc queries) 4 November 7th 05 12:25 PM
Sum a column of variable length? Brian Excel Discussion (Misc queries) 5 February 3rd 05 02:26 PM


All times are GMT +1. The time now is 01:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"