to share information with forum community
i find solution for these error
add the following line to my code that will unprotect worksheet first and at the end of code protect sheet again
ActiveSheet.Unprotect Password:="123456"
ActiveSheet.protect Password:="123456"
so my code will be like the following
Sub RectangleRoundedCorners1_Click()
ActiveSheet.Unprotect Password:="123456"
Dim xWs As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each xWs In Application.ActiveWorkbook.Worksheets
If xWs.Name <> "MyList" Then
xWs.Delete
End If
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Dim strPath As String, strFile As String, i As Long
' Prompt user to select a folder
With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = "C:\Temp\" ' Default path
.Title = "Please Select a Folder,{Coded by ExcelForum}"
.ButtonName = "Select Folder"
.AllowMultiSelect = False
.Show
If .SelectedItems.Count = 0 Then Exit Sub ' User clicked cancel
strPath = .SelectedItems.Item(1) & Application.PathSeparator
End With
Application.ScreenUpdating = False
With Sheets("MyList")
.Range("A15", .Range("A" & Rows.Count).End(xlUp).Offset(1)).ClearContents
i = 14
strFile = Dir$(strPath & "*.*")
Do While Len(strFile) > 0
i = i + 1
.Hyperlinks.Add Anchor:=.Range("A" & i), _
Address:=strPath & strFile, _
TextToDisplay:=strFile
strFile = Dir$
Loop
Columns.AutoFit
End With
Application.ScreenUpdating = True
Worksheets("MyList").Range("A:D").ColumnWidth = 40 ' for adjust column width
ActiveSheet.protect Password:="123456"
End Sub
other thank scroll probelm , when find solution will share it here also
Bookmarks