+ Reply to Thread
Results 1 to 4 of 4

Thread: Recover Cell Styles Deleted using VBA Code

  1. #1
    Registered User
    Join Date
    11-18-2008
    Location
    Dallas
    Posts
    51

    Recover Cell Styles Deleted using VBA Code

    I deleted the Styles on a worksheet using the below code
    Sub DeleteStyles()
    ' DeleteStyles Macro
    
    Dim styT As Style
    Dim intRet As Integer
    
    For Each styT In ActiveWorkbook.Styles
    If Not styT.BuiltIn Then
    styT.Delete
    End If
    Next styT
    
    MsgBox "Macro has completed running"
    
    End Sub
    The problem is after it deleted the styles I can't see the data but it is there. Is there a way to reverse the delete so that I can see the data?

  2. #2
    Registered User
    Join Date
    04-22-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Recover Cell Styles Deleted using VBA Code

    What type of file, xls or xlsx?

  3. #3
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007, 2010
    Posts
    25,764

    Re: Recover Cell Styles Deleted using VBA Code

    Don't think so. You could merge the styles from another workbook, but the cells that used those styles have reverted back to style Normal.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    03-27-2012
    Location
    Sandy, UT
    MS-Off Ver
    Excel 16
    Posts
    778

    Re: Recover Cell Styles Deleted using VBA Code

    maybe you have the cell font set to the same as the background or a custom number format that is hiding the data. try clearing all formatting from the cells or check the settings for the Normal style as shg mentioned.
    "for reals"-only used in rap and discrete math

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0