AYUDA CON ESTO, EXPERTOS

10/03/2011 - 11:33 por slillo | Informe spam
¡ Hola !

Necesito optimizar esta macro para dar formato a un excelll

Soy nuevo programando macros, y esto es muy sencillo, pero no sé como hacer para que sea más rápido con alguna condicion que se me escapa.
Como veis, depende de que encuentre un valor para pintar toda la fila hasta el final!

Os dejo el codigo...
Sub IMPORTA_TXT_VODAFONE()
Dim FName As Variant
' FName = Application.GetOpenFilename("Text files(*.txt),*.txt")
' FName será la variable que guarde el archivo de texto a leer
FName = Application.GetOpenFilename()
If FName <> False Then
Workbooks.OpenText Filename:=FName, StartRow:=1, _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, _
Tab:=True, _
DecimalSeparator:=".", ThousandsSeparator:=",", TrailingMinusNumbers:=False


Cells.Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
Range("A1").Select

' Aplicamos formato a linea FACT_CAB

[A:A].Find(What:="FACT_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato a la linea FACT_DAT

[A:A].Find(What:="FACT_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Range("A1").Select

'Aplicamos formato a la linea IDCL_CAB

[A:A].Find(What:="IDCL_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato a la linea IDCL_DAT

[A:A].Find(What:="IDCL_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Range("A1").Select

'Aplicamos formato a la linea AVPG_CAB

[A:A].Find(What:="AVPG_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato a la linea AVPG_DAT

[A:A].Find(What:="AVPG_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Range("A1").Select

'Aplicamos formato a la linea RCFE_CAB

[A:A].Find(What:="RCFE_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato al rango RCFE_DAT
[A:A].Find(What:="RCFE_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Filt = ActiveCell.Row
ColT = ActiveCell.Column

While ActiveCell = "RCFE_DAT"
If (Cells(Filt, 5) = "Total") Or (Cells(Filt, 4) = "Cuotas, Tarifas Planas y Cargos") _
Or (Cells(Filt, 4) = "Descuentos") Or (Cells(Filt, 4) = "Ajuste hasta Consumo Mínimo") Then
Range(ActiveCell, ActiveCell.Offset(0, 5)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = 0.799981688894314
End With
ElseIf Cells(Filt, 4) = "Total (Base imponible)" Then
Range(ActiveCell, ActiveCell.Offset(0, 5)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0.599963377788629
End With
Else
End If
Filt = Filt + 1
Cells(Filt, ColT).Select
Wend

Range("A1").Select

'Aplicamos formato al rango RIMP_CAB

[A:A].Find(What:="RIMP_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato al rango RIMP_DAT
[A:A].Find(What:="RIMP_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Range("A1").Select

'Aplicamos formato al rango RCLL_CAB

[A:A].Find(What:="RCLL_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato al rango RCLL_DAT

[A:A].Find(What:="RCLL_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Filt = ActiveCell.Row
ColT = ActiveCell.Column

While ActiveCell = "RCLL_DAT"
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Filt = Filt + 1
Cells(Filt, ColT).Select
Wend

Range("A1").Select

'Aplicamos formato al rango RCME_CAB

[A:A].Find(What:="RCME_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select


'Aplicamos formato al rango RCME_DAT

[A:A].Find(What:="RCME_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Filt = ActiveCell.Row
ColT = ActiveCell.Column

While ActiveCell = "RCME_DAT"
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Filt = Filt + 1
Cells(Filt, ColT).Select
Wend

Range("A1").Select

'Aplicamos formato al rango RCDA_CAB

[A:A].Find(What:="RCDA_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato al rango RCDA_DAT

[A:A].Find(What:="RCDA_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Filt = ActiveCell.Row
ColT = ActiveCell.Column

While ActiveCell = "RCDA_DAT"
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Filt = Filt + 1
Cells(Filt, ColT).Select
Wend

Range("A1").Select

'Aplicamos formato al rango RCTL_CAB

[A:A].Find(What:="RCTL_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato al rango RCTL_DAT

[A:A].Find(What:="RCTL_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Filt = ActiveCell.Row
ColT = ActiveCell.Column

While ActiveCell = "RCTL_DAT"
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Filt = Filt + 1
Cells(Filt, ColT).Select
Wend

Range("A1").Select

' Aplicamos formato a linea RDES_CAB

[A:A].Find(What:="RDES_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato a la linea RDES_DAT

[A:A].Find(What:="RDES_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Range("A1").Select

'Aplicamos formato a la linea AHCM_CAB

[A:A].Find(What:="AHCM_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato a la linea AHCM_DAT

[A:A].Find(What:="AHCM_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Range("A1").Select

'Aplicamos formato a la linea DCFC_CAB

[A:A].Find(What:="DCFC_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato a la linea DCFC_DAT

[A:A].Find(What:="DCFC_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Range("A1").Select

'Aplicamos formato a la linea DCFL_CAB

[A:A].Find(What:="DCFL_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato al rango DCFL_DAT

[A:A].Find(What:="DCFL_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Filt = ActiveCell.Row
ColT = ActiveCell.Column

While ActiveCell = "DCFL_DAT"
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Filt = Filt + 1
Cells(Filt, ColT).Select
Wend

Range("A1").Select

'Aplicamos formato al rango DCUC_CAB

[A:A].Find(What:="DCUC_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato al rango DCUC_DAT

[A:A].Find(What:="DCUC_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Range("A1").Select

'Aplicamos formato al rango DCUL_CAB

[A:A].Find(What:="DCUL_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato al rango DCUL_DAT
[A:A].Find(What:="DCUL_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Filt = ActiveCell.Row
ColT = ActiveCell.Column

While ActiveCell = "DCUL_DAT"
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Filt = Filt + 1
Cells(Filt, ColT).Select
Wend
Range("A1").Select

'Aplicamos formato al rango DDNC_CAB

[A:A].Find(What:="DDNC_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select


'Aplicamos formato al rango DDNC_DAT

[A:A].Find(What:="DDNC_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Filt = ActiveCell.Row
ColT = ActiveCell.Column

While ActiveCell = "DDNC_DAT"
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Filt = Filt + 1
Cells(Filt, ColT).Select
Wend
Range("A1").Select


'Aplicamos formato al rango DDNL_CAB

[A:A].Find(What:="DDNL_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato al rango DDNL_DAT

[A:A].Find(What:="DDNL_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Filt = ActiveCell.Row
ColT = ActiveCell.Column

While ActiveCell = "DDNL_DAT"
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Filt = Filt + 1
Cells(Filt, ColT).Select
Wend
Range("A1").Select


'Aplicamos formato al rango DNTV_CAB

[A:A].Find(What:="DNTV_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato al rango DNTV_DAT

[A:A].Find(What:="DNTV_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Filt = ActiveCell.Row
ColT = ActiveCell.Column

While ActiveCell = "DNTV_DAT"
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Filt = Filt + 1
Cells(Filt, ColT).Select
Wend


Range("A1").Select


'Aplicamos formato al rango DNTD_CAB

[A:A].Find(What:="DNTD_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato al rango DNTD_DAT

[A:A].Find(What:="DNTD_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Filt = ActiveCell.Row
ColT = ActiveCell.Column

While ActiveCell = "DNTD_DAT"
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Filt = Filt + 1
Cells(Filt, ColT).Select
Wend


Range("A1").Select

'Aplicamos formato al rango DSVA_CAB

[A:A].Find(What:="DSVA_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato al rango DSVA_DAT

[A:A].Find(What:="DSVA_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Filt = ActiveCell.Row
ColT = ActiveCell.Column

While ActiveCell = "DSVA_DAT"
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Filt = Filt + 1
Cells(Filt, ColT).Select
Wend
Range("A1").Select

'Aplicamos formato al rango DNAD_CAB

[A:A].Find(What:="DNAD_CAB", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
End With
Range("A1").Select

'Aplicamos formato al rango DNAD_DAT

[A:A].Find(What:="DNAD_DAT", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate
Filt = ActiveCell.Row
ColT = ActiveCell.Column

While ActiveCell = "DNAD_DAT"
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
End With
With Selection.Interior
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Filt = Filt + 1
Cells(Filt, ColT).Select
Wend
Range("A1").Select

Columns("A:A").EntireColumn.AutoFit
Columns("B:B").EntireColumn.AutoFit
Columns("C:C").EntireColumn.AutoFit
Columns("D:D").EntireColumn.AutoFit
Columns("E:E").EntireColumn.AutoFit
Columns("F:F").EntireColumn.AutoFit
Columns("G:G").EntireColumn.AutoFit
Columns("H:H").EntireColumn.AutoFit
Columns("I:I").EntireColumn.AutoFit
Columns("J:J").EntireColumn.AutoFit
Columns("K:K").EntireColumn.AutoFit

End If
End Sub
 

Preguntas similares