DaveRadford
Board Regular
- Joined
- Feb 18, 2010
- Messages
- 63
Afternoon,
I have some code...which is very long winded but it has two issues.
Firstly when it copies the formula in to the cell it references the target cell with speech marks for example 'B12' meaning that teh forumula lookup doesnt work.
Second problem, as you can imagine as the selection happens yuo see it jumping through the cells one by one....not what i would like people to see :/
Here is my code.....please dont laugh :D, it will do this for all cells C11-C46.
Sub CopyJobFormulas()
Range("C11").Select
ActiveCell.FormulaR1C1 = _
"=IFERROR(VLOOKUP(B11,JobList,2,FALSE),""ERROR - This is not a valid Job Number"")"
Range("C12").Select
ActiveCell.FormulaR1C1 = _
"=IFERROR(VLOOKUP(B12,JobList,2,FALSE),""ERROR - This is not a valid Job Number"")"
Range("C13").Select
ActiveCell.FormulaR1C1 = _
"=IFERROR(VLOOKUP(B13,JobList,2,FALSE),""ERROR - This is not a valid Job Number"")"
End Sub
I have some code...which is very long winded but it has two issues.
Firstly when it copies the formula in to the cell it references the target cell with speech marks for example 'B12' meaning that teh forumula lookup doesnt work.
Second problem, as you can imagine as the selection happens yuo see it jumping through the cells one by one....not what i would like people to see :/
Here is my code.....please dont laugh :D, it will do this for all cells C11-C46.
Sub CopyJobFormulas()
Range("C11").Select
ActiveCell.FormulaR1C1 = _
"=IFERROR(VLOOKUP(B11,JobList,2,FALSE),""ERROR - This is not a valid Job Number"")"
Range("C12").Select
ActiveCell.FormulaR1C1 = _
"=IFERROR(VLOOKUP(B12,JobList,2,FALSE),""ERROR - This is not a valid Job Number"")"
Range("C13").Select
ActiveCell.FormulaR1C1 = _
"=IFERROR(VLOOKUP(B13,JobList,2,FALSE),""ERROR - This is not a valid Job Number"")"
End Sub