无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

VBA批量給工作簿重命名

2023-06-11 01:11 作者:哈哈0000zero  | 我要投稿

Sub GetFiles()

? ? Dim strPath As String, strFileName As String, k As Long

? ? With Application.FileDialog(msoFileDialogFolderPicker)

? ? ? ? If .Show Then strPath = .SelectedItems(1) Else: Exit Sub

? ? ? ? '獲取用戶(hù)選擇的文件夾的路徑,如果未選取,則退出程序

? ? End With

? ? If Right(strPath, 1) <> "\" Then strPath = strPath & "\"

? ? Application.ScreenUpdating = False

? ? Range("a:b").Clear: k = 1

? ? '清除A:B列的所有

? ? Cells(1, 1) = "舊文件名": Cells(1, 2) = "新文件名"

? ? strFileName = Dir(strPath & "*.xls*")

? ? Do While strFileName <> ""

? ? ? ? k = k + 1

? ? ? ? Cells(k, 1) = strPath & strFileName

? ? ? ? strFileName = Dir

? ? Loop

? ? Application.DisplayAlerts = True

End Sub




Sub ChangeFileName()

? ? Dim r, i As Long

? ? r = Range("a1").CurrentRegion '數(shù)據(jù)裝入數(shù)組

? ? For i = 2 To UBound(r)

? ? '標(biāo)題行不要,從數(shù)組第二行開(kāi)始遍歷

? ? ? ? Name r(i, 1) As r(i, 2) 'Name語(yǔ)句重命名

? ? Next

? ? MsgBox "更名完成。"

End Sub


VBA批量給工作簿重命名的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
临朐县| 莱阳市| 芦山县| 外汇| 酒泉市| 延吉市| 贵溪市| 鱼台县| 浮梁县| 宣化县| 青龙| 平定县| 桐乡市| 正镶白旗| 买车| 嵩明县| 鄂州市| 呼玛县| 琼中| 来凤县| 密山市| 西和县| 南雄市| 望奎县| 澄迈县| 马尔康县| 南康市| 都江堰市| 竹北市| 上饶县| 综艺| 湖南省| 道真| 蒙阴县| 南投市| 荃湾区| 漳平市| 广汉市| 车险| 枞阳县| 海丰县|