Hello, I made a macro that types a formula and applies it to certain cells. However, I was wondering if it is possible to use an input box so when the macro is typing the formula we can get it to type the formula in the sheet we want but same cell. I have attached the code below. Will appreciate the help. The P in the formula I want it to be whatever we type in the input box. Thanks
Code:
Dim P As String
P = InputBox("Enter Last Month's Sheet Name")
Sheets(Format(Now(), "mmmm, yyyy")).Activate
Range("I7").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-3]=P!RC[-3],VLOOKUP(RC[-3],P!C6:C9,4,FALSE),"""")"
Range("I8").Select
End Sub