Eliminar filas especificando texto con instr.

Status
Not open for further replies.

AMAIA

New Member
Joined
Jan 10, 2022
Messages
3
Office Version
  1. 2016
Platform
  1. Web
Hola tengo el siguiente problema necesito eliminar todas las celdas que en su formula contengan #ref ejem c5= 15+ref+c10. Por eso estoy ocupando la funcion instr para que no se borre las celdas c10=5+8+c10 cuya formula no tiene ref, aunque su valor sea ref. para esto tengo la siguiente macro pero no me funciona
Prenda
Sub eliminar()
Rango de atenuación como rango
Dim pos como entero
Dim i como entero


Establecer rng = Range("b:f").SpecialCells(xlCellTypeFormulas)
Para i = rng.Cells.Count To 1 Paso -1
pos = InStr(LCase(rng.Item(i).Formula), LCase("#REF!"))
Si pos > 0 Entonces

rng.Item(i).EntireRow.Delete

Terminara si
Siguiente yo

End Sub



tengo otra que si elimina las filas pero uno lo hacelento y dos no borratodas las filas

Sub eliminar()


Gama Celda As Dim
Rango de atenuación como rango
Dim i tan largo


Establecer rng = Range("b:f").SpecialCells(xlCellTypeFormulas)

Por Cada Celda En rng

Si InStr(1, Celda.Formula, "#REF!", vbTextCompare) > 0 Entonces
Celda.Interior.Color = 65535
' Celda.EntireRow.Delete
Terminara si

Siguiente Celda


End Sub
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Duplicate to: delete rows with insrt text in the formula

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,224,862
Messages
6,181,458
Members
453,042
Latest member
AbdelrahmanExcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top