Motoracer88
New Member
- Joined
- Apr 25, 2024
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Hello, first time posting. Just want to preface with saying that I have no training in VBA. I just started playing around with it to make formatting a spreadsheet at work go a little quicker. What I'm trying to do is, after applying a filter, I want to highlight a certain group of cells containing data. I ran the "Record Macro" feature and got the following code. The part I can't seem to figure out is the Range. It needs to be dynamic because the number of rows to highlight will change from week to week as will the actual row number. I've been scouring the internet and I've tried about a dozen different things but I either get an error message or it doesn't highlight the cells that I want. Any help would be much appreciated.
VBA Code:
Sub Macro3()
'
' Macro3 Macro
'
'
ActiveSheet.Range("$A$2:$H$1000").AutoFilter Field:=2, Criteria1:="KY100"
Range("A321:E714").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End Sub