Visual Basic - eliminar filas según criterio

Life is soft - evento anual de software empresarial
 
Vista:

eliminar filas según criterio

Publicado por ernesto (1 intervención) el 30/12/2016 13:51:35
Estoy haciendo mis primeras macros. Intento hacer una macro que recorra la columna C y si está vacía la oculte. La macro me funciona pero quise agregar las líneas en comentario para reemplazar la del rango y para que el mismo termine en la última fila y no funcionó.
les dejo la macro:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Sub hOJAMOVIL()
Cell.Range("C1").Activate
'Dim UltimaFila As Double
'UltimaFila = Cells(Rows.Count, 1).End(xlUp).Row
'For Each celda In Range(Cells(3, 1), Cells(3, UltimaFila))
For Each celda In Range("C1:C2100")
 
If celda.Value = "" Then
 
ActiveCell.EntireRow.Hidden = True
 
Else
 
ActiveCell.EntireRow.Hidden = False
 
End If
 
ActiveCell.Offset(1).Select
 
Next
 
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

eliminar filas según criterio

Publicado por monnquechu (1 intervención) el 10/01/2017 23:38:42
intenta esto...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Sub hOJAMOVIL()
 
Range("C1").Activate
ultima = Range("C10000").End(xlUp)
Do Until ActiveCell = ultima
 
    If ActiveCell = "" Then
 
      ActiveCell.EntireRow.Hidden = True
 
    End If
 
ActiveCell.Offset(1, 0).Select
 
Loop
 
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar