View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Pictures adding & removal

Include a line like:

ActiveSheet.Pictures.Delete

near the top of your code.
--
Gary''s Student - gsnu200749


"Robin" wrote:

Public Sub SorteerAlleTeams1() 'op basis van clubs
Range("D3:K107").Select
Selection.Sort Key1:=Range("D3"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Dim r As Integer
r = 3 'ga naar regel 3
Do Until Cells(r, 13).Value = "" 'totdat er niets meer staat in cel (r,13)
With ActiveSheet.Pictures.Insert( _
ThisWorkbook.Path & "\Logo's\" & Cells(r, 13).Value) '"\" geeft
aan dat de plaaatjes 1 map hoger staan
.Top = Cells(r, 13).Top 'plaats waar de waarde van het logo
gelezen wordt
.Left = Cells(r, 14).Left 'plaats waar het logo terecht moet komen
.Width = (.Width / .Height) * Cells(r, 13).Height
.Height = Cells(r, 13).Height
End With
r = r + 1 'ga een regel verder
Loop 'doe opnieuw
Dim i As Integer
i = 3
Do Until Cells(i, 13).Value = ""
With ActiveSheet.Pictures.Insert( _
ThisWorkbook.Path & "\" & Cells(i, 13).Value)
.Top = Cells(i, 13).Top
.Left = Cells(i, 14).Left
.Width = (.Width / .Height) * Cells(i, 13).Height
.Height = Cells(i, 13).Height
End With
i = i + 1
Loop
Range("A1").Select
End Sub




"Gary''s Student" wrote:

Post your code.
--
Gary''s Student - gsnu200749


"Robin" wrote:

Hi,
I use a vba-button and function to add logos in a worksheet.
Everytime I use this button, the old logo is being overwritten by a new one.
I need to change the code so that the old logo is deleted before the new
one is placed.
Suggestions? Thnx