Notifications
Clear all

Nova função - UDF

5 Posts
1 Usuários
0 Reactions
826 Visualizações
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

Prezados,

gostaria de criar uma nova função que verificasse a existência de uma fórmula em uma célula do excel.

Por exemplo: =FUNÇÃO(A1)

se tiver fórmula na célula A1, a função retorna 1; ao contrário retorna 0.

é possível?

 
Postado : 30/11/2012 11:40 am
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

Function TEMFORMULA(c As Range) As Boolean
TEMFORMULA = c.hasformula
End Function

Abs,

 
Postado : 30/11/2012 12:41 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

Veja as diferenças entre Sub e Function :

VBA – As diferenças entre Sub e Function
http://www.tomasvasquez.com.br/blog/mic ... e-function

Um pouco sobre a Função : HasFormula
Show FORMULA or FORMAT of another cell
http://dmcritchie.mvps.org/excel/formula.htm

HasFormula Property
http://msdn.microsoft.com/en-us/library ... =office.11).aspx

[]s

 
Postado : 30/11/2012 1:00 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

Boa tarde!

Option Explicit 
 
Function ISFORMULA(cel As Range) As Boolean 
    ISFORMULA = cel.HasFormula 
End Function 
 
Postado : 30/11/2012 1:30 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

MANDRIX, muito obrigado.

 
Postado : 02/12/2012 9:08 pm