hey all, i have the follwing VBA that i'e written, but i think i've messed it up...
the problem being if an empty cell is found, it is populated with the exact formual as in the code. It is suppose to enter the formula with the relative cell reference for that row - e.g. if pasting the formula in my code above into cell W501 it should be populated with the following:
could anyone please help convert it to the correct format?
Code:
Sub Insert_formula6()
Dim Cell As Range
Dim InputValue As String
On Error Resume Next
ActiveWorkbook.Sheet2.Activate
lastRow = Sheet2.Range("A" & Rows.Count).End(xlUp).Row
inputformula6 = "=IF((ISERROR(MATCH(V9,'DEMPROG IMPORT'!$AA$9:$AA$5000,0))),""satis"",""live"")"
Range("w9:w" & lastRow).Select
For Each Cell In Selection
If IsEmpty(Cell) Then
Cell.Value = inputformula6
End If
Next
End Sub
the problem being if an empty cell is found, it is populated with the exact formual as in the code. It is suppose to enter the formula with the relative cell reference for that row - e.g. if pasting the formula in my code above into cell W501 it should be populated with the following:
Code:
=IF((ISERROR(MATCH(V501,'DEMPROG IMPORT'!$AA$9:$AA$5000,0))),""satis"",""live"")
could anyone please help convert it to the correct format?