I'm trying to write a macro to format a header row, but don't know how to do so until the last non-blank cell (files may have different numbers of columns). Here's what I have, clearly I don't need to go up to column XFD. how do I stop at a non-blank cell? thanks!!!
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("B7:XFD7").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.249977111117893
.PatternTintAndShade = 0
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("B7:XFD7").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.249977111117893
.PatternTintAndShade = 0