Xóa Style Trong Excel / Top 5 # Xem Nhiều Nhất & Mới Nhất 3/2023 # Top View | Hoisinhvienqnam.edu.vn

Cách Xóa Style, Delete Styles, Xóa Formating Style Cứng Đầu Trong Excel

Các bạn tải file Excel trên mạng sẽ rất nhiều khi gặp phải trường hợp trong Formating Style có rất nhiều Style không mong muốn. Vì vậy các bạn muốn xóa Style nhưng có nhiều Formating Style cứng đầu không thể xóa được.

Cách 1: Xóa Style thủ công

Cách này chỉ áp dụng cho số lượng Style cần xóa nhỏ, các bạn thực hiện như sau:

Xuất hiện các Formating Style, các bạn muốn xóa Style nào thì nhấn chuột phải vào Style đó và chọn Delete.

Cách 2: Xóa Style sử dụng code VBA

Với file Excel có nhiều Formating Style thì cách này sẽ giúp các bạn xóa tự động tất cả các Style trên file Excel, các bạn thực hiện như sau:

Visual Basic. Sub StyleKill() Dim styT As Style Dim intRet As Integer On Error Resume Next For Each styT In ActiveWorkbook.Styles If Not styT.BuiltIn Then End If Next styT End Sub

Bước 5: Nhấp đúp chuột trái vào StyleKill để chạy Module xóa Formating Style.

Cách 3: Xóa Style bằng cách xóa trên file Style.xml

Xuất hiện hộp thoại Folders Options các bạn chọn thẻ View, trong phần Advanced settings các bạn bỏ chọn trong ô vuông trước dòng Hide extensions for known file types và nhấn OK.

Bước 1: Mở file Excel .xlsx (hoặc .xls) sau đó các bạn nhấn phím F12 để mở cửa sổ Save As, lưu thành bản mới với định dạng .xlsm như hình dưới.

Bước 2: Vào thư mục chứa file .xlsm mà bạn vừa lưu, sửa định dạng .xlsm thành định dạng .zip. Xuất hiện thông báo Rename các bạn chọn Yes.

Bước 3: Nhấp đúp chuột để mở file zip, tiếp theo chọn thư mục xl.

Bước 4: Mở file chúng tôi bằng Notepad.

Bước 7: Ngay khi các bạn lưu và đóng file chúng tôi thì trên thư mục winrar của file Excel mà bạn đang mở sẽ xuất hiện thông báo file chúng tôi đã sửa đổi, các bạn chọn Yes và đóng file .zip.

Bước 8: Đổi lại file từ định dạng .zip thành .xlsm

Các bạn mở file Excel, xuất hiện thông báo We found a problem with some content… các bạn chọn Yes. Như vậy các bạn hãy xem kết quả, sau đó lưu lại định dạng .xlsx hoặc .xls tùy ý.

Cách Xóa Các Định Dạng Thiết Kế Rác (Delete Styles) Trong Excel Phiên Bản 2010, 2013, 2022

Tuyệt đỉnh Excel – Trở thành bậc thầy Excel trong 16 giờ

Một số styles (định dạng) rác, lạ hay thừa bạn có thể gặp như sau:

Xóa thủ công bằng thao tác ”Delete”

Thao tác này phải làm thủ công, chỉ có thể xóa từng styles một, gây mất thời gian và không tối ưu nếu bạn có một lượng lớn styles cần phải xóa

Xóa toàn bộ bằng lệnh VBA phục hồi style (định dạng) mặc định trong Excel

Phương án này đòi hỏi người dùng phải biết sử dụng Macro trong VBA

Sub RebuildDefaultStyles() 'The purpose of this macro is to remove all styles in the active 'workbook and rebuild the default styles. 'It rebuilds the default styles by merging them from a new workbook. 'Dimension variables. Dim MyBook As Workbook Dim tempBook As Workbook Dim CurStyle As Style 'Set MyBook to the active workbook. Set MyBook = ActiveWorkbook On Error Resume Next 'Delete all the styles in the workbook. For Each CurStyle In MyBook.Styles Select Case CurStyle.Name Case "20% - Accent1", "20% - Accent2", _ "20% - Accent3", "20% - Accent4", "20% - Accent5", "20% - Accent6", _ "40% - Accent1", "40% - Accent2", "40% - Accent3", "40% - Accent4", _ "40% - Accent5", "40% - Accent6", "60% - Accent1", "60% - Accent2", _ "60% - Accent3", "60% - Accent4", "60% - Accent5", "60% - Accent6", _ "Accent1", "Accent2", "Accent3", "Accent4", "Accent5", "Accent6", _ "Bad", "Calculation", "Check Cell", "Comma", "Comma [0]", "Currency", _ "Currency [0]", "Explanatory Text", "Good", "Heading 1", "Heading 2", _ "Heading 3", "Heading 4", "Input", "Linked Cell", "Neutral", "Normal", _ "Note", "Output", "Percent", "Title", "Total", "Warning Text" 'Do nothing, these are the default styles Case Else CurStyle.Delete End Select Next CurStyle 'Open a new workbook. Set tempBook = Workbooks.Add 'Disable alerts so you may merge changes to the Normal style 'from the new workbook. Application.DisplayAlerts = False 'Merge styles from the new workbook into the existing workbook. MyBook.Styles.Merge Workbook:=tempBook 'Enable alerts. Application.DisplayAlerts = True 'Close the new workbook. tempBook.Close End Sub

Kết quả hiện thị: File Excel của chúng ta đã hoàn toàn được loại bỏ các styles ( định dạng) lạ, rác hay thừa, đồng thời khôi phục đúng mặc định ban đầu của trang tính Excel.

Qua bài viết trên, Gitiho mong muốn cung cấp cho các bạn dân văn phòng (đặc biệt là người hay phải sử dụng Excel trong quá trình làm việc) một giải pháp tối ưu cả về mặt thời gian lẫn thao tác, khiến cho công việc xử lý hay thiết kế các bảng biểu, dữ liệu được trau chuốt, đồng nhất và đẹp mắt hơn.

Với sứ mệnh: ” Mang cơ hội phát triển kỹ năng, phát triển nghề nghiệp tới hàng triệu người “, đội ngũ phát triển chúng tôi đã và đang làm việc với những học viện, trung tâm đào tạo, các chuyên gia đầu ngành để nghiên cứu và xây dựng lên các chương trình đào tạo từ cơ bản đến chuyên sâu xung quanh các lĩnh vực: Tin học văn phòng, Phân tích dữ liệu, Thiết kế, Công nghệ thông tin, Kinh doanh, Marketing, Quản lý dự án…

Gitiho tự hào khi được đồng hành cùng:

50+ khách hàng doanh nghiệp lớn trong nhiều lĩnh vực như: Vietinbank, Vietcombank, BIDV, VP Bank, TH True Milk, VNPT, FPT Software, Samsung SDIV, Ajinomoto Việt Nam, Messer,…

Nếu bạn quan tâm đến các khóa tin học văn phòng của Gitiho, với mong muốn giỏi tin học để tăng năng suất làm việc lên gấp 5 lần, hãy truy cập ngay



How To Use Excel Styles Efficiently

Learn what styles are and how they can help you format your sheets more effectively and efficiently.

Illustration: Lisa Hornung

Styles are a Microsoft Word feature, right? You might be surprised to learn that Microsoft Excel uses styles too, although the nature of the data doesn’t require the same kind of robust options. Excel styles are easier to use than Word’s. If you’re not using them because you think they’re complicated, you might want to reconsider. In this article, I’ll introduce you to Excel styles and show you how to use them to use more efficiently in Excel.

I’m using (desktop) Office 365 but you can use an earlier version. You can work with your own data or download the demonstration .xls file. Styles are available in the browser edition.

LEARN MORE: Office 365 for business

What’s a Microsoft Excel style?

If you don’t work with styles, you might be wondering what’s so special about them. The easy answer is, they help you work more efficiently. A style is a collection of formats that you can apply simultaneously. For instance, you might want all input cells to have a green background with white font. By using a style, you can apply both formats at the same time. Now, that doesn’t sound like a big deal, but there’s more. If you decide to change the format for input cells, you don’t have to change all those cells individually. You simply change the style and all input cells update automatically-now that’s working efficiently.

Styles in Microsoft Excel

Figure A

Styles aren’t as obvious in Excel (and other Office 365 apps) as they are in Word. On the Home tab, you’ll find styles in the Styles group, Format a Table, and Cell Styles. We’re going to work with the Cell Styles option. As you can see in Figure A, the dropdown offers several built-in cell styles.

Whether or not you realize it, you’re using a style called Normal-that’s the sparse formatting you see when you enter data in a new sheet. Toward the bottom of the gallery ( Figure A) you’ll see Comma, Comma[0], Currency, and so on. You’re also already using these styles when you choose a from from the dropdown in the Number group.

Working with styles in Excel

This bit is important: If you see formatting but Normal is selected in the Styles gallery, you know that you’re seeing direct formatting; that format was applied manually. Direct, or one-off, formatting is fine, but when you start mixing it with styles too much, things can get confusing. It’s better in the long run to modify the style than to manually apply more formatting to a cell that has an applied style.

Select Modify.

Let’s see what happens to cell I9 when we modify the Input style:

Now, let’s make a more drastic change. Let’s suppose that you want to add bold to the italicized cells in columns E and G and change the font color to dark green. Now, you could use direct formatting on one of those cells and then use the Format Painter, but modifying the applied style is quicker and guarantees consistency in the future. Let’s try that.

From the Color dropdown, choose dark green (Figure E).

Figure E

First, check one of the cells to see what style is applied. (I showed you how to do that earlier. In this case, the style is Explanatory. With the gallery open, continue as follows:

Figure F

We updated the Explanatory style, changing the formatting for several cells at once. It’s important to remember that if you have other cells with the same style, they will update, too. In most cases, that’s what you’ll want. If not, you might need to create a new style. Use the Duplicate option instead of choosing Modify (in the gallery), then name the new style and make changes. It’s quicker than starting from scratch.

One more thing

Cell styles reflect the theme that’s applied to the entire workbook file. When you change one theme to another, cell styles change accordingly.

Excel cell styles are easy to implement. Knowing they exist and how to determine what’s in use and how to modify a style are the keys to using them efficiently.

Also see

Delete All Custom Cell Styles Excel

Asked

Is it possible to delete ALL the custom/created cell styles in a workbook ? Just leaving the default styles.

Without having to delete them all one by one

PeterH PeterH

6,412 16 16 gold badges 40 40 silver badges 74 74 bronze badges

Try this small VBA macro:

Sub StyleKiller() Dim N As Long, i As Long With ActiveWorkbook N = .Styles.Count For i = N To 1 Step -1 If Not .Styles(i).BuiltIn Then .Styles(i).Delete Next i End With End Sub

This resolves the Builtin vs Custom issue. Note we run the loop backwards to avoid corrupting the loop index.

To simply remove all without using INDEX, try the below:

Sub StyleKiller() Dim st As Style On Error Resume Next For Each st In ActiveWorkbook.Styles If Not st.BuiltIn Then st.Delete End If Next On Error GoTo 0 End Sub

Ok, this wasn’t as hard to do as I first thought.

Bit messy as I don’t often use vba; but this code will roll back to just the default styles:

Sub DefaultStyles() Dim MyBook As Workbook Dim tempBook As Workbook Dim CurStyle As Style Set MyBook = ActiveWorkbook On Error Resume Next For Each CurStyle In MyBook.Styles Select Case chúng tôi Case "20% - Accent1", "20% - Accent2", _ "20% - Accent3", "20% - Accent4", "20% - Accent5", "20% - Accent6", _ "40% - Accent1", "40% - Accent2", "40% - Accent3", "40% - Accent4", _ "40% - Accent5", "40% - Accent6", "60% - Accent1", "60% - Accent2", _ "60% - Accent3", "60% - Accent4", "60% - Accent5", "60% - Accent6", _ "Accent1", "Accent2", "Accent3", "Accent4", "Accent5", "Accent6", _ "Bad", "Calculation", "Check Cell", "Comma", "Comma [0]", "Currency", _ "Currency [0]", "Explanatory Text", "Good", "Heading 1", "Heading 2", _ "Heading 3", "Heading 4", "Input", "Linked Cell", "Neutral", "Normal", _ "Note", "Output", "Percent", "Title", "Total", "Warning Text" Case Else CurStyle.Delete End Select Next CurStyle Set tempBook = chúng tôi Application.DisplayAlerts = False MyBook.Styles.Merge Workbook:=tempBook Application.DisplayAlerts = True tempBook.Close End Sub

The issue of custom styles is also discussed in http://support.microsoft.com/kb/213904

I found that installing the free “XLStyles Tool” from MS Store as suggested in the KB article was a very convenient way to delete the custom styles.

Super User works best with JavaScript enabled