I want to delete objects and replace the spaces left after that with symbols in black (color)
Option Explicit
Sub delete_objects()
Dim i As Long, k As Long, arr(), text As String, dic As Object
ReDim arr(1 To Sheet1.Shapes.Count, 1 To 2)
For i = 1 To Sheet1.Shapes.Count
If Sheet1.Shapes(i).Line.EndArrowheadStyle = 2 Then
k = k + 1
arr(k, 2) = Sheet1.Shapes(i).TopLeftCell.Address
Sheet1.Shapes(i).Name = "temp_" & k
arr(k, 1) = "temp_" & k
End If
Next i
Set dic = CreateObject("Scripting.Dictionary")
For i = 1 To k
Sheet1.Shapes(arr(i, 1)).Delete
If Not dic.exists(arr(i, 2)) Then
text = Sheet1.Range(arr(i, 2)).Value
text = Replace(text, String(5, " "), " " & ChrW(8594), , 1)
Sheet1.Range(arr(i, 2)).Value = text
dic.Add arr(i, 2), ""
End If
Next i
Set dic = Nothing
End Sub
The above VBA code replaces the objects with a symbol (an arrow pointing right) in the color of whatever number or text that preceded it before the macro was run but the spaces remain. Please tweak the code above to help remove the spaces left behind after that as well. Please also make sure that your solution acts only on column J and skips blank/empty cells also. It should also recolor all the symbols black (color).