muhammad susanto
Well-known Member
- Joined
- Jan 8, 2013
- Messages
- 2,077
- Office Version
- 365
- 2021
- Platform
- Windows
hi all...
i have macro code to delete all picture (3 pict) in a sheet in condition MERGED cell..
the picture in cell B6 (no merge cell), C6:D6 (merged cell) and E6:F6 (merged cell)
here this code :
note :
name of sheet are random name
this macro not work for merged cell...
how to modify that code so work in merged cell
thank for your helping
.sst
i have macro code to delete all picture (3 pict) in a sheet in condition MERGED cell..
the picture in cell B6 (no merge cell), C6:D6 (merged cell) and E6:F6 (merged cell)
here this code :
VBA Code:
Sub deletePicturesFromMergedCells()
Dim sh As Shape, ws As Worksheet
Dim rng As Range
Set ws = Worksheets......( [B]" i want name of sheet is random)"[/B])
For Each sh In ws.Shapes
'if shape is picture
If sh.Type = msoPicture Or sh.Type = msoLinkedPicture Then
'get entire range where picture placed
Set rng = ws.Range(sh.TopLeftCell, sh.BottomRightCell)
'if picture is in range A8 (with megred cells) then delete it
If Not Intersect(rng, ws.Range("B6:F6").MergeArea) Is Nothing Then
sh.Delete
End If
End If
Next sh
End Sub
note :
name of sheet are random name
this macro not work for merged cell...
how to modify that code so work in merged cell
thank for your helping
.sst