Usuário com melhor resposta
excell inputbox

Pergunta
-
gostaria de automatizar a ocultação da planilha digitando atraves de um inputbox a celulas, como faço isso?
Tentei criar as variaveis, mas não deu certo, pois em vba não experiencia ?
Tb gostaria do codigo de tratamento de erro.
ActiveCell.FormulaR1C1 = "Reg:" & InputBox("Digite o Registro n.º", "Digite o Registro")
Range("B3").Select
ActiveCell.FormulaR1C1 = "Nome: " & InputBox("Digite o Nome ", "Digite o Nome")
Rows("2:475").Select
Selection.EntireRow.Hidden = True
Range("P479").Select
ActiveCell.FormulaR1C1 = DateValue(InputBox("Digite a Data INICIO no formato DD/MM/YYYY "))
Range("Q549").Select
ActiveCell.FormulaR1C1 = DateValue(InputBox("Digite a Data FIM no formato DD/MM/YYYY "))
Respostas
Todas as Respostas
-
-
-
Neste vc informa apenas o nº da linha, testa este código
Sub OcultaLinha()
Dim linha As Variant
Do While Not linha = IsNumeric(linha)
linha = (InputBox("Qual linha será ocultada?"))
If linha = "" Then Exit Sub
If linha <= 65536 And linha >= 1 Then
Rows(linha).Select
Selection.EntireRow.Hidden = True
Else
MsgBox "Valor inválido, tente novamente!", vbExclamation, "Erro"
End If
Loop
End Sub -