G
Guest
Dear Helper,
I have the following script to add a formular to a cell in all the sheets in
Workbook(final_bk) and copy down to the last used cells in the respective
sheet.
The script stop at vLookup line, how should I set the formula ?
For Each sh In Workbooks(final_bk).Worksheets
sh.Activate
If sh.Name <> "Summary" Then
ActiveSheet.UsedRange.Select
numcolumns = Selection.Columns.Count
numRows = Selection.Rows.Count
Cells(2, numcolumns + 1).Formula =
"=IF(A2<>"",VLOOKUP(A2,[WORKBOOKS(source_book)]sheets("Source")!$A:$B,2,false)"
Cells(2, numcolumns + 1).AutoFill Destination:=Range("")
Columns(numcolumns + 1).Copy
Columns(numcolumns + 1).PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
Next sh
I have the following script to add a formular to a cell in all the sheets in
Workbook(final_bk) and copy down to the last used cells in the respective
sheet.
The script stop at vLookup line, how should I set the formula ?
For Each sh In Workbooks(final_bk).Worksheets
sh.Activate
If sh.Name <> "Summary" Then
ActiveSheet.UsedRange.Select
numcolumns = Selection.Columns.Count
numRows = Selection.Rows.Count
Cells(2, numcolumns + 1).Formula =
"=IF(A2<>"",VLOOKUP(A2,[WORKBOOKS(source_book)]sheets("Source")!$A:$B,2,false)"
Cells(2, numcolumns + 1).AutoFill Destination:=Range("")
Columns(numcolumns + 1).Copy
Columns(numcolumns + 1).PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
Next sh