-3

Need a VBA code. rename sheets from list

I have a list of names in sheet 2 cell w3 thru w22. I need to name sheets/tabs 3 thur 22 from the the list of names. The names change. and if no name in w3 thru w22. I want the tabs to be numbered 1 thru 20 Any Ideas?

4

1 回答 1

0
    Dim MyCell As Range, MyRange As Range, Dim i As Integer 

    Set MyRange = Sheets("Summary").Range("w3") 
    Set MyRange = Range(MyRange, MyRange.End(xlDown)) 

    For Each MyCell In MyRange 
    If MyCell.Value IS NULL
    Sheets(Sheets.Count + 3).Name = i
    Sheets(Sheets.Count + 3).Name = MyCell.Value ' renames the new worksheet 
    Next MyCell 

或者类似的事情,我没有测试它,因为你没有给我们任何东西来解决或者自己努力解决它。 http://en.kioskea.net/faq/27361-excel-a-macro-to-create-and-name-worksheets-based-on-a-list感谢这个网站给了我一个基础.

于 2015-06-11T22:32:17.870 回答