I'm a vba novice but working on it...
I have a subroutine within the "Names" worksheet that checks the value of a specific cell (selected cell in Column 5) and if it meets the criteria (contains a "V"), it copies an image from another worksheet (Images) and pastes it into a different cell (Column B) in the same row. Everything works but I still get a RunTime Error '13' Type Mismatch. I'm baffled.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim tr As Long
tr = Target.Row
If Target.Column = 5 And Target.Value = "V" Then
Worksheets("Images").Shapes("Picture 1").Copy: Worksheets("Names").Range("B" & tr).PasteSpecial
End If
End Sub
Thanks for your quick response! I updated my Excel version (Home and Student 2021). I've also attached a simplified sample excel file with my VB code. I've been playing around with it and it appears I only get that error when I click on a column (ie. A, B, C)?
I could live with it, but another person using this workbook would get confused...
Also, I have another question related to this worksheet. If I enter a "V" into column 5, it correctly pastes a flag image into column D same row, but what if I entered the "V" by mistake? I can delete the flag image itself, but I cannot delete the "V" in column 5.
Note that in the code, flagcopy logic was added later, after I was already getting the RunTime Error 13.
I hope I'm explaining this ok?