LATEST NEWS

6/recent/ticker-posts

How to Bulk Rename Excel Sheet Name with their File Names

How to Bulk Rename Excel Sheet Name with their File Names

The code used for the video below has not been tested for the latest versions and we've tried to bring this back after our recent unfortunate incidents with our File Hosting service. 

Nonetheless, you can try to use it and test it out for yourself. If you'd get into any trouble, just comment down your issue below.



Here are the codes:

Sub iSchoolFormsBulkRenamer()

'URL https://facebook.com/IntegratedSchoolForms

'Website https://eduknasyon.blogspot.com

    Dim MyFolder As String

    Dim MyFile As String

    Dim wbname As String


'Insert Location = URL/Address of Folder

    MyFolder = "INSERT LOCATION"

    MyFile = Dir(MyFolder & " / .xlsx")


    Application.ScreenUpdating = False

    Do While MyFile <> ""


        Workbooks.Open FileName:=MyFolder & " / " & MyFile

        With ActiveWorkbook

            wbname = Left(.Name, InStr(.Name, ".") - 1)

            .Sheets(1).Name = wbname

            .Close savechanges:=True


        End With

        MyFile = Dir


    Loop

    Application.ScreenUpdating = True


End Sub



Note:

There's a possibility that the apostrophe ( ' ) and quotation marks ( " " ) will be read different by your MS Excel VBA, so, if there's any error, when you copy and paste the code above in your Excel VBA window, type the apostrophes and quotation marks again from the code above. This is sometimes caused by the system format of our browsers in reading text as a "formatted text type" instead of a unicode.

 Good luck and hope this helps out!



Post a Comment

0 Comments