hi,ive thousands of sheets.
im trying to run this vba but it end with error.i saved the file as macro enabled or theres any other way to save macro file?
can someone help how to fix?
im trying to run this vba but it end with error.i saved the file as macro enabled or theres any other way to save macro file?
Code:
Public Sub BuildMyFormula()
Dim sFormula As String
'Provide the cell address in format like A1, B1 etc
CellName = InputBox("Please provide cell address like A1", "Cell Address")
sFormula = ""
'This builds up the formula on its own
For i = 1 To Sheets.Count
sFormula = sFormula & "(" & Sheets(i).Name & "!" & CellName & ">=50)" & "*" & _
Sheets(i).Name & "!" & CellName & ","
Next i
'Removes unnecessary comma
sFormula = Left(sFormula, Len(sFormula) - 1)
'Sets the formula in active cell
ActiveCell.Formula = "=SUM(" & sFormula & ")"
End Sub