I'm working with a spreadsheet that requires the use of a table. I resize it to only include the headers and the first line of data I'm working with, but when I then refit it to cover all of my existing data, it overwrites the formatting and resets the color back to default white. I need these colors as they are referenced later in the code. Is there a way to prevent the table from doing this?
Dim FLF As Worksheet
Set FLF = Workbook("My Workbook").Sheets("FLF")
Dim x As Long
Dim lng As Long
With FLF
FLF.Activate
.ListObjects("Table1").Resize Range("$A$6:$K$7")
lng = .Cells(.Rows.count, "D").End(xlUp).Row
.Range("E7:G" & lng).NumberFormat = "0.00%"
.ListObjects("Table1").Resize Range("$A$6:$K$" & lng)
For x = 7 To lng
If .Range("A" & x).Interior.ColorIndex = 46 Then
TopPercent = .Range("K" & x).Value
Do
x = x + 1
.Range("K" & x) = TopPercent * .Range("F" & x).Value
.Range("K" & x).Font.FontStyle = "Italic"
Loop While .Range("A" & x + 1).Interior.ColorIndex = 36
End If
Next x