I am having issue to make macro to insert formula. In other excel spreadsheet similar macro was working fine, but here I am having issues.
I want to insert formula to A25 and basically drag down until A75... Formula is =IF(OR(Data!C2=""),"",Data!C2)
I tried couple of options, but no luck. I have a feeling this is due to IF in formula
Can you help me please?
Or
I want to insert formula to A25 and basically drag down until A75... Formula is =IF(OR(Data!C2=""),"",Data!C2)
I tried couple of options, but no luck. I have a feeling this is due to IF in formula
Can you help me please?
VBA Code:
Sub RunFormulaStores() 'inserting formula for workgroup
'Dim last_row As Long
Dim iRange As Range
Set iRange = Range("A25:A75")
'last_row = Cells(Rows.Count, 4).End(xlUp).Row
iRange.Formula = "=IF(OR(Data!C2=""""),"""",Data!C2))"
' for every " in excel formula need to add, also in ran-ge there is drag down until last row
Range("A25").AutoFill Destination:=Range("A25:A75") '& last_row)
End Sub
VBA Code:
Sub x()
Dim ws As Worksheet
Set ws = Sheets("Settings")
ws.Activate
Range("A24").Formula = "=IF(OR(Data!C2=""""),"""",Data!C2))"
End Sub