0

As a simple example if i have the a sheet with cell

A1= AUM

And i have the following sub:

Public Sub MainValuesInForm()
    Dim Wanted_Data As String
    
    Wanted_Data = "AUM"
    ActiveCell.Formula = "=IF(""Wanted_Data""=A1,1,2)"
        
End Sub

In this case, Wanted_Data does equal A1 so it should return 1. However, the formula that is inserted into the activecell is always

=IF("Wanted_Data"=A1,1,2)

How can i get the desired behavior such that in this case it becomes:

=IF("AUM"=A1,1,2)
daniel stafford
  • 241
  • 1
  • 8

0 Answers0