0
運行以下代碼時,我收到Subscript out of range - error 9
。有人能告訴我我做錯了什麼嗎?下標超出範圍 - 錯誤#9
Sub testing1()
Dim Fso As FileSystemObject
Dim Fldr As Folder
Dim Fpath As String
Dim Fl As File
Dim Sh As Worksheet
Dim cell As Range
Dim Myvalue As String
Application.DisplayAlerts = False
Myvalue = Application.InputBox("Enter your value")
Set Fso = New FileSystemObject
With Application.FileDialog(msoFileDialogFolderPicker)
.Show
Fpath = .SelectedItems(1)
End With
Set Fldr = Fso.GetFolder(Fpath)
For Each Fl In Fldr.Files
For Each Fl In Fldr.Files
For Each Sh In Workbooks(Fl.Name).Sheets
For Each cell In Sh.UsedRange
If cell.Value = Myvalue Then
cell.Interior.ColorIndex = 12
End If
Next cell
Next Sh
Next Fl
Next Fl
End Sub
+ 1但是,一個提示,而不是循環,你可以使用'.Replace'? –