Forum Discussion
Excel
Jun 18, 2022Iron Contributor
Format as table with the help of VBA code
Hello Everyone, I have tried to change FORMAT AS TABLE in all sheets in same time with the help of VBA code. It is run right but it came different color.. like - So, what shoul...
- Jun 18, 2022
Excel Try this:
Sub Macro4() Dim w As Worksheet Dim r As Range For Each w In Worksheets If w.ListObjects.Count < 1 Then Set r = w.Range("A1").CurrentRegion r.Interior.ColorIndex = xlColorIndexNone w.ListObjects.Add(Source:=r).Name = w.Name End If Next w End Sub
HansVogelaar
Jun 18, 2022MVP
Excel Try this:
Sub Macro4()
Dim w As Worksheet
Dim r As Range
For Each w In Worksheets
If w.ListObjects.Count < 1 Then
Set r = w.Range("A1").CurrentRegion
r.Interior.ColorIndex = xlColorIndexNone
w.ListObjects.Add(Source:=r).Name = w.Name
End If
Next w
End Sub
- ExcelJun 18, 2022Iron ContributorThank you so much sir