Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I'm new to programming in VBA so please have some patience with m ignorance. I am trying write some VBA code to AutoFill a column with a formula Normally, I can just use: Range("C1").Select ActiveCell.FormulaR1C1 = "=RC[-2]/RC[-1]" Range("C1").Select Selection.AutoFill Destination:=Range("C1:C10"), Type:=xlFillDefault Range("C1:C10").Select The problem is, the number of rows is variable so I don't want to se the number of rows finitely to 10. How can I AutoFill the column to the number of rows that matches th number of rows of data? I know there is an END property that exists Can I use that? Any help is greatly appreciated. Thanks in advance. Regards, Wai Shin -- Shin ----------------------------------------------------------------------- Shing's Profile: http://www.excelforum.com/member.php...fo&userid=3603 View this thread: http://www.excelforum.com/showthread.php?threadid=55822 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub tst()
' find first non emty cells in column A from bottom up (r) r = Cells(65500, 1).End(xlUp).Row Range("C1").Select ActiveCell.FormulaR1C1 = "=RC[-2]/RC[-1]" Range("C1").Select Selection.AutoFill Destination:=Range("C1:C" & r), Type:=xlFillDefault End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks very much. That worked a treat. Regards, Wai Shing -- Shing ------------------------------------------------------------------------ Shing's Profile: http://www.excelforum.com/member.php...o&userid=36031 View this thread: http://www.excelforum.com/showthread...hreadid=558222 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Inserting Variable Number of Rows | Excel Programming | |||
change the number of rows to a variable | Excel Programming | |||
change the number of rows to a variable | Excel Programming | |||
Autofilling a formula to a variable last cell | Excel Programming | |||
deleting variable number of rows | Excel Programming |