
evento TextBox_change()
Publicado por guihe (38 intervenciones) el 02/03/2009 12:47:48
Hola a todos,
a ver si a alguien se le ocurre alguna solución a mi problema... Os cuento, tengo un textbox dentro de un userform y al introducir un dato en este cuadro se duplica una hoja, el problema es que si introduzco un dato de 2 cifras el codigo corre dos veces y me da error. Os pongo el codigo para aclarar algo el asunto. Supongo que es por el tipo de evento _Change()
Private Sub txtbxCLARA0_Change()
If txtbxCLARA0.Value = True Then
'se duplica la hoja en el caso de que se vaya a efectuar una clara
Sheets("t(0)").Copy Before:=Sheets("t(0)")
Sheets("t(1)").Name = "t(0)ac"
Range("A5").FormulaR1C1 = "ac"
ActiveSheet.Next.Select 'vuelve a la hoja t(0)
End If
CommandButton1.Enabled = False
Dim cCc As Object
CommandButton1.Enabled = True
For Each cCc In Frame1.Controls
If cCc.Tag = 1235 Then cCc.Enabled = True
Next
If OptionButton1.Value = True Or OptionButton2.Value = True Or _
OptionButton3.Value = True Or OptionButton4.Value = True Then
CommandButton1.Enabled = True
End If
End Sub
Mucahs gracias
a ver si a alguien se le ocurre alguna solución a mi problema... Os cuento, tengo un textbox dentro de un userform y al introducir un dato en este cuadro se duplica una hoja, el problema es que si introduzco un dato de 2 cifras el codigo corre dos veces y me da error. Os pongo el codigo para aclarar algo el asunto. Supongo que es por el tipo de evento _Change()
Private Sub txtbxCLARA0_Change()
If txtbxCLARA0.Value = True Then
'se duplica la hoja en el caso de que se vaya a efectuar una clara
Sheets("t(0)").Copy Before:=Sheets("t(0)")
Sheets("t(1)").Name = "t(0)ac"
Range("A5").FormulaR1C1 = "ac"
ActiveSheet.Next.Select 'vuelve a la hoja t(0)
End If
CommandButton1.Enabled = False
Dim cCc As Object
CommandButton1.Enabled = True
For Each cCc In Frame1.Controls
If cCc.Tag = 1235 Then cCc.Enabled = True
Next
If OptionButton1.Value = True Or OptionButton2.Value = True Or _
OptionButton3.Value = True Or OptionButton4.Value = True Then
CommandButton1.Enabled = True
End If
End Sub
Mucahs gracias
Valora esta pregunta


0