Dear Friends,
Please find the vba code below.
Its does copy & paste special data related to another sheet in the sheet.
The macro fails if there are protected cells in the sheet.
Could you please assist me in solving the issue.
Co
Sub Break_Link_Col_ActiveNext()
'
' Macro1 Macro
'
'Dim abc As Range
ActiveWindow.ActivateNext
Dim wb As Workbook
Dim wb2 As Workbook
Set wb = ThisWorkbook
Dim cell As Range
Set Rng = Application.InputBox( _
Title:="Break_links", _
Prompt:="Select a cell/range to break links", _
Type:=8)
If Rng Is Nothing Then
MsgBox "please select range/cell"
Else
m = Rng.Address
End If
'Below code would do a for loop
For Each cell In Range(m)
If IsEmpty(cell) Then
GoTo B
Else
abc = cell.Address
If (InStr(1, Range(abc).Formula, "!", vbTextCompare)) > 0 Then
Range(cell.Address).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End If
End If
B:
Next cell
Application.CutCopyMode = False
MsgBox "Break link done"
End Sub
Bookmarks