View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Les Stout[_2_] Les Stout[_2_] is offline
external usenet poster
 
Posts: 396
Default Help with Vlookup

Hi all,
I have one workbook that i open and then make a variable
activeWorkbook.Name and want to use the variable name in the formula,
but it does not like it, could you tell me what i am doing wrong ?
ActiveCell.Offset(0, 11).FormulaR1C1 =
"=VLOOKUP(RC[-11],SuppFileNameC!A:N,12,0)"

i have the following code that i got from this site and now i need to
put in some vlookups, is it possible ?

Sub InsertCalcS()
Dim rng As Range
Dim Lrow As Long
Dim CalcMode As Long
Const col As String = "I" '<<== CHANGE

Lrow = Cells(Rows.Count, col).End(xlUp).Row

On Error GoTo XIT

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

Set rng = Range(col & "4:" & col & Lrow) '<=== From row 4
With rng
.FormulaR1C1 = "=SUM(RC[-2]-RC[-1])" '<<== CHANGE
.Offset(0, 1).FormulaR1C1 = _
"=SUM(RC[-1]*RC[-5])" '<<== CHANGE
End With

XIT:
With Application
.Calculation = CalcMode
.ScreenUpdating = True
End With
TotalsS
End Sub

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***