VBA Help with looping formula

XCL_88

New Member
Joined
Aug 23, 2013
Messages
1
Hi Guys, I have a massive template that has a large number of formulas in the spreadsheet so I wanted to reduce the size by building the formulas in a macro and have the macro enter the result in a hard coded value.

I'm not great with macros but I did a few searches and have the following -

Code:
Sub Template_CheckFlags()

Dim LastRow As Long
LastRow = Range("T_Salary_ID").Cells(1, 1).Row + Range("T_Salary_ID").Rows.Count - 1


For i = 8 To LastRow


    If IsEmpty(Range(i, "T_Previous_Position_Title")) = False Then
    
        ActiveSheet.Range("T_Previous_Position_Title").Formula = "=VLookup(T_Salary_ID.Value, DB_Cur, 13, False)"
        
    End If
Next i
End Sub

Can someone please help me update the macro so it does the following -

  • Find the last row in "T_Salary_ID" (named range)
  • then enter the formula in "T_Previous_Position_Title" which is the title of my named range
  • Have the result of Vlookup entered as a hard coded value

Thanks heaps!
 

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top