Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Selección de un rango desde celda activa hasta última celda con datos, aunque haya celdas vacías entre medias y borrar la selección

publicado

Buenos días! A ver si alguien puede ayudarme... ?

Dada la celda activa, quiero seleccionar todas las celdas hacia abajo y hacia la derecha, hasta las últimas celdas con datos, aunque haya celdas vacías entre medias, y borrar su contenido.

He probado de mil maneras y no doy con la buena..... Creo que lo que más se acerca a lo que quiero es esto, aunque no lo estoy aplicando correctamente porque me da error en 'Range' de '_Objeto' global:

                    busca.Offset(filatm + 1, -13).Select
                    Dim abajo As Range, derecha As Range
                    abajo = Range(ActiveCell, Range(ActiveCell).End(xlDown).SpecialCells(xlCellTypeLastCell)).Select
                    derecha = Range(ActiveCell, Range(ActiveCell).End(xlToRight).SpecialCells(xlCellTypeLastCell)).Select
                    Range(abajo, derecha).Clear

No sé qué estoy poniendo mal...

Gracias de antemano! ?

 

Featured Replies

publicado

Hola,

Prueba así a ver sí te lo coje...(cambio en rojo)

abajo = Range(ActiveCell, Range(ActiveCell).End(xlUp).SpecialCells(xlCellTypeLastCell)).Select

publicado

@Enid86 , prueba con el código:
 

Sub borrar()
Dim uc&, uf&, rng As Range

uc = Cells(ActiveCell.Row, Columns.Count).End(xlToLeft).Column
uf = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row

Set rng = Union(Range(Cells(ActiveCell.Row, ActiveCell.Column), Cells(ActiveCell.Row, uc)), Range(Cells(ActiveCell.Row, ActiveCell.Column), Cells(uf, ActiveCell.Column)))
rng.ClearContents

End Sub

 

publicado
With ActiveCell
   .Resize(Rows.Count - .Row, Columns.Count - .Column).Clear
End With

 

publicado
  • Autor
Hace 4 horas, Antoni dijo:

With ActiveCell
   .Resize(Rows.Count - .Row, Columns.Count - .Column).Clear
End With

 

Sencillo y perfecto, como siempre.... Muchas gracias, Antoni. ??

publicado
  • Autor

Muchas gracias a todos!?

Hace 5 horas, ikanni dijo:

Hola,

Prueba así a ver sí te lo coje...(cambio en rojo)

abajo = Range(ActiveCell, Range(ActiveCell).End(xlUp).SpecialCells(xlCellTypeLastCell)).Select

 

Hace 4 horas, Haplox dijo:

@Enid86 , prueba con el código:
 


Sub borrar()
Dim uc&, uf&, rng As Range

uc = Cells(ActiveCell.Row, Columns.Count).End(xlToLeft).Column
uf = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row

Set rng = Union(Range(Cells(ActiveCell.Row, ActiveCell.Column), Cells(ActiveCell.Row, uc)), Range(Cells(ActiveCell.Row, ActiveCell.Column), Cells(uf, ActiveCell.Column)))
rng.ClearContents

End Sub

 

 

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.