Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
try Sub InsertFormulas() dim lastrow as long With Sheets("Book In") lastrow = .Cells(Rows.count, "A").End(xlUp).row end with with Sheets("Book In").Range("C2:C" & lastrow) ' Adjust the range in col C to suit ' the max likely number of data rows in col A .FormulaR1C1 = _ "=IF(RC1="""","""",VLOOKUP(RC1,PartNumbers! R2C1:R1000C2,2,FALSE))" 'convert formulas to values ..value=.value End With End Sub -----Original Message----- Hi guys, I'm trying to improve the sub below, so that: a) it auto-detects the extent of the data range in col A (A2:Ax, where x = last cell) and inserts the vlookup formula correspondingly into col C b) it will then auto-convert the returns in col C to values, after calculation Sub InsertFormulas() With Sheets("Book In").Range("C2:C100") ' Adjust the range in col C to suit ' the max likely number of data rows in col A .FormulaR1C1 = _ "=IF(RC1="""","""",VLOOKUP(RC1,PartNumbers! R2C1:R1000C2,2,FALSE))" End With End Sub Thanks for insights -- Rgds Max xl 97 --- Please respond in thread xdemechanik <atyahoo<dotcom ---- . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 SP1 - How to correct scrollbar extent? | Excel Discussion (Misc queries) | |||
How do I make a formula automatically detect changes in values | Excel Worksheet Functions | |||
Convert Data Range in to individual values | Excel Discussion (Misc queries) | |||
how do i detect like text and add corresponding values? | Excel Discussion (Misc queries) | |||
Defining Range Extent | Excel Programming |