shieldsco
asked on
Excel VBA Format Text
I need to format multiple Columns A,D,I,L Text on all worksheets except for 2 (Invoice and Summary).
ASKER
I get the following runtime error 1004 method range of object _worksheet failed on .Range("A").NumberFormat = "@"
Code:
Sub Demo()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws
If .Name <> "Invoice Sheet" And .Name <> "Summary Sheet" Then
.Range("A").NumberFormat = "@"
.Range("D").NumberFormat = "@"
.Range("L").NumberFormat = "@"
End If
End With
Next
End Sub
Code:
Sub Demo()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws
If .Name <> "Invoice Sheet" And .Name <> "Summary Sheet" Then
.Range("A").NumberFormat = "@"
.Range("D").NumberFormat = "@"
.Range("L").NumberFormat = "@"
End If
End With
Next
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window