Hello all! This is my first post here.
I want to subtract Revenues from Expenses to find a P&L number. The code I used below is to find the row number where Revenues and Expenses are in the Excel file. The formula is where I am having trouble. The formula is being entered in cell H90.
Dim Rev As Integer
Dim Exp As Integer
Rev = Application.WorksheetFunction.Match("Revenues", Range("C:C"), 0)
Exp = Application.WorksheetFunction.Match("Expenses", Range("C:C"), 0)
Range("H90").Select
ActiveCell.Formula = "=H[Rev]-H[Exp]"
The formula is clearly wrong, but I am unsure how to reference those Match values in the formula. Any help would be appreciated.
Thanks,
Ryan
I want to subtract Revenues from Expenses to find a P&L number. The code I used below is to find the row number where Revenues and Expenses are in the Excel file. The formula is where I am having trouble. The formula is being entered in cell H90.
Dim Rev As Integer
Dim Exp As Integer
Rev = Application.WorksheetFunction.Match("Revenues", Range("C:C"), 0)
Exp = Application.WorksheetFunction.Match("Expenses", Range("C:C"), 0)
Range("H90").Select
ActiveCell.Formula = "=H[Rev]-H[Exp]"
The formula is clearly wrong, but I am unsure how to reference those Match values in the formula. Any help would be appreciated.
Thanks,
Ryan