Visual Basic - combobos condicionados

Life is soft - evento anual de software empresarial
 
Vista:

combobos condicionados

Publicado por Silvia (1 intervención) el 05/02/2008 16:15:15
Hola a todos!
Estoy intentando condicionar dos combobox en un excel de manera que dependiendo de lo que se ponga en el desplegable del primero el segundo tenga unos u otros caracteres previamente determinados de un rango oculto de celdas que se encuentra en la misma hoja del excel.
He probado de todo pero el código qeu he creado con el Visual Basic no acaba de funcionar y no se por que!</p><p>Podriais ayudarme??? muchisimas gracias. El código que hice es este:


Private Sub ComboBox2_Change()

If ComboBox1.Value = "aeronaves" Then
ComboBox2.Range = ("AL9")
End If

If ComboBox1.Value = "agrario maquinaria agrícola" Then
ComboBox2 = Range("AL11:AL16").Value
End If
If ComboBox1.Value = "artes graficas" Then
ComboBox2 = Cells("AL18:AL30").Range
End If
If ComboBox1.Value = "embarcaciones" Then
ComboBox2.Range = ("aAL32")
End If
If ComboBox1.Value = "Equipamiento deportivo" Then
ComboBox2.Range ("AL34")
End If
If ComboBox1.Value = "equipamiento medico" Then
ComboBox2.Range ("AL36:AL51")
End If
If ComboBox1.Value = "informatica" Then
ComboBox2.Range ("AL53:AL61")
End If
If ComboBox1.Value = "Inmuebles/solares/fincas rusticas" Then
ComboBox2.Range ("AL63:AL77")
End If
If ComboBox1.Value = "Mantenimiento - carretillas elevadoras" Then
ComboBox2.Range ("AL79:AL82")
End If
If ComboBox1.Value = "Maquinaria general" Then
ComboBox2.Range ("AL84:AL126")
End If
If ComboBox1.Value = "Maquinaria General - Otros Servicios" Then
ComboBox2.Range ("AL128:AL132")
End If
If ComboBox1.Value = "Maquinaria hosteleria" Then
ComboBox2.Range ("AL134")
End If
If ComboBox1.Value = "Obras públicas y construcciones" Then
ComboBox2.Range ("AL137: AL160")
End If
If ComboBox1.Value = "Ofimatica" Then
ComboBox2.Range ("AL162: AL165")
End If
If ComboBox1.Value = "Otros elementos de manutencion" Then
ComboBox2.Range ("AL167: AL168")
End If
If ComboBox1.Value = "telecomunicaciones" Then
ComboBox2.Range ("AL170: AL174")
End If
If ComboBox1.Value = "transporte" Then
ComboBox2.Range ("AL176: AL190")
End If
If ComboBox1.Value = "tratamiento de la imagen" Then
ComboBox2.Range ("AL192: AL198")
End If
If ComboBox1.Value = "vehiculos" Then
ComboBox2.Range ("AL200: AL209

End If

End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder