Forum Discussion
Excel
Mar 15, 2021Iron Contributor
Question related to unselect worksheet
Hello Everyone, I have 3 question - 1 -- Currently my coding can make "Good" in all worksheet except for DATA worksheet. my concern is I don't want "good" in "DATA, DATA1 and DATA2" worksheet. ...
HansVogelaar
Mar 16, 2021MVP
You have to make sure that you refer to ws.Range(...) in the loop. If you simply use Range(...), it refers to the active sheet instead of to ws.
Sub Text2Column()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
Select Case ws.Name
Case "Data", "Manage", "Instruction"
' Skip these sheets
Case Else
ws.Range(ws.Range("A9"), ws.Range("A9").End(xlDown)).TextToColumns _
Destination:=ws.Range("A9"), DataType:=xlDelimited, _
Space:=True, Semicolon:=True, Tab:=True, Comma:=True
ws.Range("B:I").EntireColumn.AutoFit
End Select
Next ws
End Sub- ExcelMar 16, 2021Iron ContributorIt worked! Thank you so much sir😊😊