AT_TreeFortConsulting
New Member
- Joined
- Aug 3, 2021
- Messages
- 14
- Office Version
- 2016
- Platform
- Windows
I have a table that I've created buttons to filter by current week, current month, and to clear all filters. The table can get very long, and I have information at the top that will push the table too far down the page if I freeze rows to always show buttons. I'm trying to create a button that always floats at the bottom of my table. I found code to float a button based on my selected cell, and that works great, but if I select a cell anywhere in the table, the button follows. I just want it to stay at the bottom. I also get a run-time error '1004': Application-defined or object-defined error if I select anything other than a single cell.
My goals:
My goals:
- always have the button float below the bottom left corner of the unfiltered rows of my table
- moves with the table based on the filtered options
- down when I add a row(s) to the table
- doesn't error out if I select something like an entire row or column
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo 0
With ActiveSheet.Shapes("Rectangle: Rounded Corners 10")
.Top = Target.Offset(2, 0).Top
.Left = Target.Offset(2, 0).Left
End With
End Sub