Log in

View Full Version : Script Error In Visual Basic


nicolebolin
Feb 23, 2007, 10:55 AM
:confused: Please help...

I am writring a macro in visual basic and am coming across an error. Here is the script:

Sheets("AllSidneyPlantOrders").Select
Range("O1").Select
ActiveCell.FormulaR1C1 = "COMMENTS"
Range("O2").Select
ActiveCell.FormulaR1C1 = _
"=IF((VLOOKUP(G6,'\\fs46nfa\vol1\OrdersDue\Plant8Ma cro\[2.16.07.xls]AllSidneyPlantOrders'!$G:$O,9,FALSE))=(VLOOKUP(M6, '\\fs46nfa\vol1\OrdersDue\Plant8Macro\[2.16.07.xls]AllSidneyPlantOrders'!$M:$O,3,FALSE)),(VLOOKUP(G6, '\\fs46nfa\vol1\OrdersDue\Plant8Macro\[2.16.07.xls]AllSidneyPlantOrders'!$G:$O,9,FALSE)))"
Selection.FillDown
Range("E3").Select
ActiveWindow.DisplayZeros = False
Columns("O:O").Select
Selection.Font.Bold = False
Selection.Font.Bold = True
End Sub

I am getting an error on the IF formaula line. I double checked the formula in excel and the formula is correct. If this is something I cannot do how can I write scipt a macro that will bring up a box to allow the user to pull in a specified file and then perform the scipt I have above?