I have the following code
'Insert/put HW formula
Workbooks(Gradebook_Filename).Worksheets(Gradebook_Sht_Nm_Roster).Range("G2").Formula = _
"=IF(ISERROR(VLOOKUP(A2," & Gradebook_Sht_Nm_HW & "!$A$2:$V$" & _
Rster_lst_row & ",22,FALSE)),""NA"", " & "VLOOKUP(A2," & Gradebook_Sht_Nm_HW & "!$A$2:$V$" & _
Rster_lst_row & ",22,FALSE))"
Which i thought would "select" cell G2 on the appropriate sheet and then paste the formula. However, what i get is the formula pasted into a totally different cell. To get the formula pasted into G2 i actually need to have the following code.
'For some reason i need the next statement otherwise the formulas are not put into the correct place
Application.Goto Workbooks(Gradebook_Filename).Worksheets(Gradebook_Sht_Nm_Roster).Range("G2")
'Insert/put HW formula
Workbooks(Gradebook_Filename).Worksheets(Gradebook_Sht_Nm_Roster).Range("G2").Formula = _
"=IF(ISERROR(VLOOKUP(A2," & Gradebook_Sht_Nm_HW & "!$A$2:$V$" & _
Rster_lst_row & ",22,FALSE)),""NA"", " & "VLOOKUP(A2," & Gradebook_Sht_Nm_HW & "!$A$2:$V$" & _
Rster_lst_row & ",22,FALSE))"
Does anyone know why? I think its a "selection" issue but i am not sure.
DAvid
Bookmarks