I am trying to apply a format to every worksheet in my current workbook. I have tried "For Each" and I have tried to Loop through until I reach last worksheet but both error due to different reasons. Can someone please tell me what I'm doing wrong?
Method 1: It works on the 1st worksheet but not on the remaining worksheets.
Sub format_worksheets() Dim ws As Worksheet For Each ws In Worksheets Columns("A:A").Select Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _ TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _ Semicolon:=False, Comma:=True, Space:=False, Other:=True,TrailingMinusNumbers:=True Range("A1").Select Next ws End Sub Method 2: It doesn't recognise the last worksheet.
Sub format_worksheets() Dim ws As Worksheet ws = Worksheet.Active Do code Loop Until ws = Sheets(Sheets.Count).Active End Sub