Re: [算表] 有關sheet 大量更名的動作(VBA)

看板Office作者 (windknife18)時間15年前 (2010/07/23 18:19), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
以下是 VBA 使用方法請參考之前文章或精華區囉 Option Explicit Sub Macro1() Dim index As Integer Dim oriM As Integer Dim nowM As Integer Application.DisplayAlerts = False Application.ScreenUpdating = False For index = 1 To Sheets.Count 'MsgBox Sheets(index).Name If (InStr(Sheets(index).Name, "月") > 0) Then oriM = Left(Sheets(index).Name, InStr(Sheets(index).Name, "月") - 1) nowM = oriM + 1 If (nowM > 12) Then nowM = 1 End If Sheets(index).Name = nowM & Mid(Sheets(index).Name, _ InStr(Sheets(index).Name, "月")) End If Next index Application.ScreenUpdating = True Application.DisplayAlerts = True End Sub ※ 引述《gogobloke (德國的血液在沸騰)》之銘言: : 軟體: excel : 版本: 2003 : 各位前輩好 : 我的問題是有個excel檔 : 有31個SHEET : 每個sheet排列為 "7月1日" "7月2日"........"7月31日" : 到次月的時候 想改為 "8月1日".............."8月31日" : 請問有沒有辦法呢 爬過文 有一篇類似 不過不適合我用的 : 對vb又不熟@@ 先謝謝大家了 : ps 想開始學vb 可是同事說 vb快被淘汰了 是在嘴砲還是事實呀 : 沒有vb 那是用什麼來輔助excel呢? 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.116.146.144 ※ 編輯: windknife18 來自: 122.116.146.144 (07/23 18:20)
文章代碼(AID): #1CIMoV4W (Office)
文章代碼(AID): #1CIMoV4W (Office)