Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formula fill down
Hi,
I am using this part of a macro to enter a formula into J2 and then fill it down. However, the amount of rows differs and I only want to fill it down to the last row. Range("J2").Select ActiveCell.FormulaR1C1 = _ "=IF(RC[-1]24, ""Greater than 24 Hours"", ""Less than 24 Hours"")" Range("I2:J701").Select Selection.FillDown How can I have it know what the last row is and stop there? Thanks!!! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formula fill down
Change Range("I2:J701").Select to
Range("I2", Range("J2").End(xlDown)).Select Charles xl Geek dan wrote: Hi, I am using this part of a macro to enter a formula into J2 and then fill it down. However, the amount of rows differs and I only want to fill it down to the last row. Range("J2").Select ActiveCell.FormulaR1C1 = _ "=IF(RC[-1]24, ""Greater than 24 Hours"", ""Less than 24 Hours"")" Range("I2:J701").Select Selection.FillDown How can I have it know what the last row is and stop there? Thanks!!! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formula fill down
how about something like this, without selecting anything?
Option Explicit Sub test() Dim LastRow As Long LastRow = Worksheets("Sheet1").Cells(Rows.Count, "i").End(xlUp).Row Range("J2").Formula = "=IF(i2 24, ""Greater than 24 Hours"", ""Less than 24 Hours"")" Range("J2").AutoFill Range("j2:j" & LastRow) End Sub -- Gary "dan" wrote in message oups.com... Hi, I am using this part of a macro to enter a formula into J2 and then fill it down. However, the amount of rows differs and I only want to fill it down to the last row. Range("J2").Select ActiveCell.FormulaR1C1 = _ "=IF(RC[-1]24, ""Greater than 24 Hours"", ""Less than 24 Hours"")" Range("I2:J701").Select Selection.FillDown How can I have it know what the last row is and stop there? Thanks!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
formula fill down | Excel Discussion (Misc queries) | |||
Fill formula from VBA | Excel Programming | |||
Formula Fill help | Excel Worksheet Functions | |||
Can't fill XL Formula in VBA | Excel Programming | |||
Using VB to fill a formula down | Excel Programming |