I am trying to make my combobox dropdown list functional.
where I would like to increment value in the cell +1 in the other sheet and copy the shape from another sheet at once.
I wrote the code like this:
Private Sub ComboBox1_Change()
Dim rng As Range
Dim picName As String
Set rng = ActiveSheet.Range("B65")
picName = "Firestop"
Select Case rng
Case "CFS-PL 107"
Worksheets("hilti firestopping stores").Range("E5").Value = Range("E5") + 1
Worksheets("hilti firestopping stores").Shapes("Firestop_Plug").Copy
ActiveSheet.Range("L24").PasteSpecial Name = "Firestop"
End Select
End Sub
I have got basically 2 problems here:
- The value in the cell "E5" increases only up to 1. If I select this case egain it remains still 1, whereas it should be 2, as I set the +1 increment.
- The objects (images) are copied properly, although I would like to set them some unique name, other than "Picture..." which would be next ordered with numeration the same as in the case of "Picture".
The question here: How to rename the selected shape in Excel doesn't solve my problem, because there is no information about the incremented order of the shape id. I found something similar here:
set shapes name after specialpaste?
And tried to use in my code:
Worksheets("hilti firestopping stores").Shapes("Firestop_Plug").Copy
ActiveSheet.Range("L24").PasteSpcial
With .Shapes(.Shapes.Count)
.Name = "Firestop"
End With
But I am getting an error: **
Compile error: Invalid or unqualified reference
**


Set rng = ...OrDim rng As StringDim rng As String, that's very confusing.