Delete Filters And Cell

Hello everyone,

I work on a process.
I need to copy a previous version of a xlsx file, delete some cells (on many sheets) and copy new value in it.

But when I copy my old version, some users have left filters, and prevent me from correctly deleting my old values before putting new ones in.

Do you have a solution to remove all the filters? (There are more than 10 sheets, so not a solution to do it with clicks)

Thanks everyone :sunglasses:

You can invoke macro to turn off all filters from all sheets.

For Each sheet in Sheets
set filter to OFF

Karthik Byggari

1 Like

It’s a protected file, and I don’t have access to the macro, etc. I can still enter values inside, and click on the column to manually remove the filters.

With the execution of the macro, I am required to be an administrator of the file, right?

we can use EXCEL APPLICATION SCOPE AND a READ RANGE ACTIVITY where if the option use filter is disbaled it wont take the filter even if it is applied

and then to delete cell value we do that with normal assign activity like this
this will delete the particular cell value
Yourdatatable.RowS(rowindex)(“columnname”) = string.Empty
where rowindex usually starts from 0 for the first row

this will enter new value if we want
Yourdatatable.RowS(rowindex)(“columnname”) = "new value"

kindly try this and let know for any queries or clarification
Cheers @Zeynk

Thanks , I’ll try.
But why doesn’t a Delete range technically work? Knowing that we’re giving the range, but doesn’t take effect if there’s a filter?

Thanks for the help :wink:

1 Like

As it is in protected mode.
May be I m not we need to try once with that file
But fetching the data from datatable format would be robust always
Cheers @Zeynk

I’ll try the method.
But I think that in terms of optimization, I’m still going to waste a lot of time modifying one by one.
That’s 500 rows, about to be emptied of 15 columns.

Thanks again :wink:

1 Like

To optimize,

Use read range activity to read the data into a data table.
Modify the data table as per your needs
And then write the data table to the excel.

Karthik Byggari

That’s fine buddy
Read range from excel activities can handle that much rows and columns
Kindly try and let know for any queries or clarification

Cheers @Zeynk

Hey, I’m back.

I used the technique (although it is relatively long to empty each cell). Once the values are replaced after Yourdatatable.RowS(rowindex)(“columnname”) = string.Empty, I have to Write Cell the datatable in the Excel file?
If so, it unfortunately does not work. :cry:

1 Like

No not in write cell buddy
With a single assign activity having this expression

Yourdatatable.Rows(rowindex)(“columnname”) = "new value"

Cheers @Zeynk

Hey buddy,

I Understand, but it’s modify only the DataTable. I want to clear the Excel file too. :slightly_smiling_face:

EDIT : I notice that I hadn’t reported that I also wanted to remove the content of the Excel page in the filter.

Fine this expression would have changed in the datatable and if this is written back to excel with write range activity then it would be updated In excel as well

Cheers @Zeynk

Unfortunately, only the “filtered” values are changed. The entire excel array hidden from him under the filter, is not modified… :frowning:

Can you use hotkeys instead of clicks or macros?

Ctrl + Shift + L to turn on/off filtering (if filtering is off, you can go to a stray cell and try to turn it on and it will error with a message that “This can’t be applied to the specified range. Select a single cell in a range and try again.”)

Ctrl + PgUp / PgDn to switch between worksheets

Hey Kristopher,

I’ve already tried.
The file is protected and I don’t have control with the shortcut.

Can you create a new file instead of editing the old one? Then you can copy the records out of the original file into the new file that you have full control over.

No I Can’t , I really need to use this file :confused:

So if you have to use the same spreadsheet, can you just click on the Enable Content since it is protected and then use the shortcuts on each worksheet?

And why do you have to use the same spreadsheet?

@Palaniyappan Hola, espero estés bien, te escribí al correo que tienes registrado.