- 08 Fev 2018 às 12:55
#30103
Ola, pessoal do VBA
É o seguinte. Eu preciso criar uma maneira de verificar se as textbox estão vazias e as que estiverem, receber o valor 0. Criei uma sub cheio de IFs, mas acredito que exista uma maneira de otimizar a execução. Podem me ajudar? Desde já agradeço
É o seguinte. Eu preciso criar uma maneira de verificar se as textbox estão vazias e as que estiverem, receber o valor 0. Criei uma sub cheio de IFs, mas acredito que exista uma maneira de otimizar a execução. Podem me ajudar? Desde já agradeço
Código: Selecionar todos
Sub ValidaVazios()
With Me
If .TextBox1.Value = "" Then
.TextBox1.Value = 0 * 1
End If
If .TextBox2.Value = "" Then
.TextBox2.Value = 0 * 1
End If
If .TextBox3.Value = "" Then
.TextBox3.Value = 0 * 1
End If
If .TextBox4.Value = "" Then
.TextBox4.Value = 0 * 1
End If
If .TextBox5.Value = "" Then
.TextBox5.Value = 0 * 1
End If
If .TextBox6.Value = "" Then
.TextBox6.Value = 0 * 1
End If
If .TextBox7.Value = "" Then
.TextBox7.Value = 0 * 1
End If
If .TextBox8.Value = "" Then
.TextBox8.Value = 0 * 1
End If
If .TextBox9.Value = "" Then
.TextBox9.Value = 0 * 1
End If
If .TextBox10.Value = "" Then
.TextBox10.Value = 0 * 1
End If
If .TextBox11.Value = "" Then
.TextBox11.Value = 0 * 1
End If
If .TextBox12.Value = "" Then
.TextBox12.Value = 0 * 1
End If
End Sub
Se eu te ajudei, deixa um "Obrigado"
Gladstone Delfino
Gladstone Delfino