#1
  1. Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    14
    Rep Power
    0

    Renaming Excel sheet with Visual Basic


    Hey

    How to rename excel sheet from within VBA code (module)?

    I need this as I have to export data to access database and no punctuation is allowed. Original names have punctuation.

    Thanks
  2. #2
  3. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    793
    Here is a little snippet that will rename all the sheets in the workbook to "sht"#
    Code:
        Dim txtCnt As Integer
        Dim i As Integer
        iCnt = Application.Sheets.Count
        For i = 1 To iCnt
            Application.Sheets(i).Name = "sht" & i
        Next
  4. #3
  5. Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    14
    Rep Power
    0
    I'm glad this snippet worked ...unlike my freshly installed office.

    Thank U huge
    Last edited by biaz; March 28th, 2003 at 02:28 AM.

IMN logo majestic logo threadwatch logo seochat tools logo