I'm new to the group/VBA so please forgive me if I'm not as concise as I should be.
I've got a macro that adds a formula to a range of cells. However, the range has filters and when I apply one and run the code, the formula is only added to visible cells and not the rows that are filtered out.
Is there a way to get the code to ignore applied filters? I'd prefer not to use ShowAllData to remove the filters so as users are working with the file they are able to keep their place if/when they run the code.
Function RefreshFormulas()
Dim ws As Worksheet
Set ws = ActiveSheet
Dim used As Range
Set used = ws.UsedRange
Dim LastRow As Integer
LastRow = used.Row + used.Rows.Count - 1
ws.Range("A5:A" & LastRow).Formula = "=IF(ISBLANK(RC6),"""",'Report Setup'!R9C2)"
End Function
Say my range has 3,000 rows. When not filtered, the code above will fill the used range in column A with the formula in all 3,000 rows. However, if I was to filter a column and now only 500 rows are visible, the formula would only be added to those 500 rows. I'd like the code to be run on all 3,000 rows regardless of filters.