Birden fazla hücrede değişiklik olunca çalışan makro

Katılım
27 Ocak 2021
Mesajlar
96
Excel Vers. ve Dili
2019 turkce
merhabalar aşagıdaki gibi kodum var M5 hücresi değişince makro çalışıyor bura kadar sıkıntı yok , ben M5 hücresine ek olarak M13 hücresi değişincede aynı makro çalışsın istiyorum yani m5 veya m13 de değişiklik olunca çalışsın istiyorum düzeltme yapablirseniz memnun olurum.

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [M5]) Is Nothing Then Exit Sub
On Error Resume Next
ActiveSheet.DrawingObjects.Delete
Dim resimyolu As String
Dim resim As Picture
resimyolu = ActiveWorkbook.Path & "\" & Sheets(2).[M5] & ".jpg"
Set resim = ActiveSheet.Pictures.Insert(resimyolu)
With Range("V2")
resim.Top = .Top
resim.Left = .Left
resim.Height = .Height
resim.Width = .Width
End With
[K19] = "Yukarıda beyan ettiğim tarihler arasında" & " " & [M13] & " " & "Gün kullanmak istiyorum." & Chr(10) & "Arz Ederim" & " " & Date
End Sub
 

Muzaffer Ali

Destek Ekibi
Destek Ekibi
Katılım
5 Haziran 2006
Mesajlar
5,838
Excel Vers. ve Dili
2019 Türkçe
Merhaba.
2. satırdaki [M5] bunu silin yerine bunu kopyalayın Range("M5, M13")
 

veyselemre

Özel Üye
Katılım
9 Mart 2005
Mesajlar
3,593
Excel Vers. ve Dili
Pro Plus 2021
Kod:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Union([M5], [M13])) Is Nothing Then Exit Sub
    If [M5].Value <> "" And [M13].Value <> "" Then
        If ActiveSheet.DrawingObjects.Count > 0 Then ActiveSheet.DrawingObjects.Delete
        Dim resimyolu$, resim As Picture
        resimyolu = ActiveWorkbook.Path & "\" & [M5] & ".jpg"
        If Dir(resimyolu) <> "" Then
            Set resim = ActiveSheet.Pictures.Insert(resimyolu)
            With Range("V2")
                resim.Top = .Top
                resim.Left = .Left
                resim.Height = .Height
                resim.Width = .Width
            End With
            [K19].Value = "Yukarıda beyan ettiğim tarihler arasında" & " " & [M13] & " " & "Gün kullanmak istiyorum." & Chr(10) & "Arz Ederim" & " " & Date
        End If
    End If
End Sub
 
Katılım
27 Ocak 2021
Mesajlar
96
Excel Vers. ve Dili
2019 turkce
Kod:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Union([M5], [M13])) Is Nothing Then Exit Sub
    If [M5].Value <> "" And [M13].Value <> "" Then
        If ActiveSheet.DrawingObjects.Count > 0 Then ActiveSheet.DrawingObjects.Delete
        Dim resimyolu$, resim As Picture
        resimyolu = ActiveWorkbook.Path & "\" & [M5] & ".jpg"
        If Dir(resimyolu) <> "" Then
            Set resim = ActiveSheet.Pictures.Insert(resimyolu)
            With Range("V2")
                resim.Top = .Top
                resim.Left = .Left
                resim.Height = .Height
                resim.Width = .Width
            End With
            [K19].Value = "Yukarıda beyan ettiğim tarihler arasında" & " " & [M13] & " " & "Gün kullanmak istiyorum." & Chr(10) & "Arz Ederim" & " " & Date
        End If
    End If
End Sub
ilginiz için teşekkür ederim fakat bu kodda çalışmadı ne m5 nede m13 değişince işlem yapmıyor
 
Katılım
27 Ocak 2021
Mesajlar
96
Excel Vers. ve Dili
2019 turkce
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Union([M5], [M13])) Is Nothing Then Exit Sub
On Error Resume Next
ActiveSheet.DrawingObjects.Delete
Dim resimyolu As String
Dim resim As Picture
resimyolu = ActiveWorkbook.Path & "\" & Sheets(2).[M5] & ".jpg"
Set resim = ActiveSheet.Pictures.Insert(resimyolu)
With Range("V2")
resim.Top = .Top
resim.Left = .Left
resim.Height = .Height
resim.Width = .Width
End With
[K19] = "Yukarıda beyan ettiğim tarihler arasında" & " " & [M13] & " " & "Gün kullanmak istiyorum." & Chr(10) & "Arz Ederim" & " " & Date
End Sub
kodu bu şekilde yazınca birde korumalı hücre varmış kaldırınca çalıştı ilginiz için teşekkür ederim
 
Üst