Hi, when I run the macro, it should give me a percentage on the cell b2, but instead, I'm receiving an #name? error that can be fixed just clicking in the code on excel and pressing enter and the formula still the same, why it doesn't start to run the percentage automatic and how it can be fixed?
here is my code
Code
- Sub FormulaCalculoB2()
- Range("A1:A999").Find(What:="=Convidados!A2").Select UltimoAssociado = ActiveCell.Row - 1
- Range("B2").Formula = "=COUNTIF(B4:B" & UltimoAssociado & ",""P"") / (@CONT.SE(B4:B" & UltimoAssociado & ",""P"") + (@CONT.SE(B4:B" & UltimoAssociado & ",""F"")))"
- End Sub
- Sub AddProjReuRep()
- Columns("B").Insert
- Columns("B").ColumnWidth = 18
- Range("B2").Style = "Percent"
- Range("B3").Value = DateValue(Date)
- Range("B3").Font.Bold = False
- Range("A1:A999").Find(What:="=Convidados!A2").Select
- UltimoAssociado = ActiveCell.Row - 1
- UltimoRange = "B4:B" & UltimoAssociado
- If ActiveSheet.Name = "Projetos" Then
- Range("B1").Value = "Nome do projeto"
- Range("B4").Value = "F"
- Range("B4").Select Selection.AutoFill Destination:=Range(UltimoRange), Type:=xlFillDefault FormulaCalculoB2
- ElseIf ActiveSheet.Name = "Reunioes" Then
- Range("B1").Value = "Nome da reuniao"
- Range("B4").Value = "F"
- Range("B4").Select Selection.AutoFill Destination:=Range(UltimoRange), Type:=xlFillDefault FormulaCalculoB2
- Else
- Range("B1").Value = "Nome da reposicao"
- Range("B2").Value = " - "
- End If
- End Sub