Necesitaría me ayudaras a crear una macro que me permita aplicar color a celdas mediante un formato condicional. El rango a cubrir es "D10 a EW100"
1 respuesta
Respuesta de tavopz
1
1
tavopz, Conozco un poco acerca de Excel (fórmulas y VBA), pregunta y si...
No entiendo tu pregunta. ¿Necesitas aplicar formato condicional mediante una macro? No suena muy lógico. Quizás si me cuentas qué resultado deseas obtener.
Tavopz, En el rango d10 a ew100 tengo detallados diferentes datos (números del 1 al 20). Y necesito colorear las celdas de acuerdo al dato que tengan. Es decir, si en la celda dice 1 que la pinte de verde, si dice 2 de azul... y así sucesivamente El formato condicional del excel, admite solo tres variables. Por lo que, necesitaria crear una macro que admitiera como mínimo 20 variables. A otra consultante la ayudaste con esta macro... c = InputBox("Indique la Columna") a = InputBox("Desde") b = InputBox("Hasta") For x = Int(a) To Int(b) Range(c & LTrim(Str(x))).Select If Selection.Value = "1" Then With Selection.Interior .ColorIndex = 17 .Pattern = xlSolid End With Else If Selection.Value = "2" Then With Selection.Interior .ColorIndex = 18 .Pattern = xlSolid End With Else If Selection.Value = "3" Then With Selection.Interior .ColorIndex = 19 .Pattern = xlSolid End With Else If Selection.Value = "4" Then With Selection.Interior .ColorIndex = 20 .Pattern = xlSolid End With Else If Selection.Value = "5" Then With Selection.Interior .ColorIndex = 21 .Pattern = xlSolid End With Else If Selection.Value = "6" Then With Selection.Interior .ColorIndex = 22 .Pattern = xlSolid End With Else If Selection.Value = "7" Then With Selection.Interior .ColorIndex = 23 .Pattern = xlSolid End With Else If Selection.Value = "8" Then With Selection.Interior .ColorIndex = 24 .Pattern = xlSolid End With Else If Selection.Value = "9" Then With Selection.Interior .ColorIndex = 25 .Pattern = xlSolid End With Else If Selection.Value = "10" Then With Selection.Interior .ColorIndex = 26 .Pattern = xlSolid End With Else If Selection.Value = "11" Then With Selection.Interior .ColorIndex = 27 .Pattern = xlSolid End With End If End If End If End If End If End If End If End If End If End If End If Next x End Sub Esta selecciona una columna... yo necesito la misma pero que tome las columnas desde la "D" hasta EW". Espero haber sido mas clara.. Muchas gracias por tu atención. Mirian
Quizás algo como esto te sirva: http://es.geocities.com/webtavopz/Files/coloresceldas.xls Puedes cambiar la macro insertando el rango que deseas y completar con el resto de colores.