Hi, Im looking for help to create a macro to find blank cells in a certain range and then insert a formula in.
For example I have data in a5:Q25 but cells g22:g25 are blank. I want the macro to find the empty cells and fill in a vlookup formula. The code I pasted below is overwriting cells that are not blank.
Also I have a header on this data that starts in Row4, so rows 1-3 are mostly blank.
Sub Copy_down()
'Find First Blank Rows
Worksheets("PCR Log").Activate
Dim First As Range
Dim Last As Range
Set First = Range("g" & Rows.Count).End(xlUp)
Set Last = Range("f" & Rows.Count).End(xlUp)
Range("g" & First, "g" & Last).FormulaR1C1 = "=IFERROR(VLOOKUP(RC[1],Skus!C[-4]:C[-1],4,FALSE),"""")"
For example I have data in a5:Q25 but cells g22:g25 are blank. I want the macro to find the empty cells and fill in a vlookup formula. The code I pasted below is overwriting cells that are not blank.
Also I have a header on this data that starts in Row4, so rows 1-3 are mostly blank.
Sub Copy_down()
'Find First Blank Rows
Worksheets("PCR Log").Activate
Dim First As Range
Dim Last As Range
Set First = Range("g" & Rows.Count).End(xlUp)
Set Last = Range("f" & Rows.Count).End(xlUp)
Range("g" & First, "g" & Last).FormulaR1C1 = "=IFERROR(VLOOKUP(RC[1],Skus!C[-4]:C[-1],4,FALSE),"""")"