看板 Visual_Basic 關於我們 聯絡資訊
你先察看Cells(1,3)這一欄的文字,是否有無法用於命名的文字, 不確定的話,可以將該cell的文字,用一個純文字檔命名看看, 或許可以知道為什麼~~ 建議 sheetname =cstr(Cells(1, j)) <<這樣改 我的拙見~~參考看看~~ ※ 引述《yaochi (ddd)》之銘言: : 請教一下各位 : 我想要依照儲存格的名稱 命名新的分頁 : 分別是 位址 Cells(1,2) Cells(1,3) Cells(1,4) ............ : 寫了一段主體程式如下 : 在 j=2 (第一次回圈) 還正常 但是到 j=3 的時候 : 就會卡在 ### 那一行 錯誤碼 1004 不知道原因為何 : 請高手指導一下 感謝 : Sub 新增分頁() : Dim sheetname As String : Dim j As Integer : For j = 2 To 4 : sheetname = Cells(1, j) ### : With Worksheets.Add : .Name = sheetname : End With : Next j : End Sub -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.230.234.36