View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default How to create a variable selected range

Hi Ronald,

Am Sat, 20 Aug 2011 02:30:15 -0400 schrieb kittronald:

A B C D
1 ABC 1 2 3
2 BCD
3 CDE
4 DEF
5 EFG

In this case, B1:D1 would be filled down to row 5.


'Last used column
LCol = Cells(1, Columns.Count).End(xlToLeft).Column
'Last used Row
LRow = Cells(Rows.Count, 1).End(xlUp).Row
Range(Cells(1, 2), Cells(1, LCol)).AutoFill _
Destination:=Range(Cells(1, 2), Cells(LRow, LCol))


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2