Public Sub DiagnosticoDadosConcessionaria()
Dim ws As Worksheet
Set ws = Worksheets("DadosConcessionária")
Dim erros As String
erros = ""
' Verifica valores de base
If [Link]("X9").Value = "" Then erros = erros & "- Potência base (X9)
está vazia" & vbCrLf
If [Link]("AH9").Value = "" Then erros = erros & "- Tensão base (AH9)
está vazia" & vbCrLf
' Verifica se z_base e i_base foram calculados
If [Link]("G13").Value = "" Then erros = erros & "- Impedância base
(G13) não calculada" & vbCrLf
If [Link]("G15").Value = "" Then erros = erros & "- Corrente base
(G15) não calculada" & vbCrLf
' Verifica impedâncias
If [Link]("AM13").Value = "" Or [Link]("AM15").Value = "" Then
erros = erros & "- Impedância Z1 incompleta" & vbCrLf
If [Link]("AW13").Value = "" Or [Link]("AW15").Value = "" Then
erros = erros & "- Impedância Z2 incompleta" & vbCrLf
If [Link]("BG13").Value = "" Or [Link]("BG15").Value = "" Then
erros = erros & "- Impedância Z0 incompleta" & vbCrLf
' Verifica se correntes foram calculadas
If [Link]("AC13").Value = "" Then erros = erros & "- ICC3F não
calculada" & vbCrLf
If [Link]("S13").Value = "" Then erros = erros & "- ICCF-Tmáx não
calculada" & vbCrLf
If [Link]("AA15").Value = "" Then erros = erros & "- Ângulo ICC3F não
calculada" & vbCrLf
If [Link]("S13").Value = "" Then erros = erros & "- Ângulo ICCF-Tmáx
não calculada" & vbCrLf
' Resultado
If erros = "" Then
MsgBox "? Diagnóstico: Tudo parece estar funcionando corretamente.",
vbInformation
Else
MsgBox "?? Diagnóstico: Foram encontrados os seguintes problemas:"
& vbCrLf & erros, vbExclamation
End If
End Sub
Sub BuscarManipulacoesLinha12()
Dim comp As Object, linha As Long
Dim padrao As Variant
padrao = Array("Cells(12,", "Range(""AL"" &", "Offset(1,", "Resize")
[Link] "?? Buscando referências indiretas à linha 12..."
For Each comp In [Link]
If [Link] = 1 Or [Link] = 2 Then
For linha = 1 To [Link]
Dim texto As String
texto = [Link](linha, 1)
Dim termo As Variant
For Each termo In padrao
If InStr(1, texto, termo, vbTextCompare) > 0 Then
[Link] "?? Módulo '" & [Link] & "' linha " & linha &
": " & texto
End If
Next termo
Next linha
End If
Next comp
[Link] "? Busca estendida concluída"
End Sub