I have a macro which filters a list and copies the values filtered (isn't the important part),
From that list I need to check if certain values exist, for example "Gestión de dato maestro". If this cell exists then I want to create a square in some cell with the text "Gestión de dato maestro".
I tried using Vlookup in vba but it didnt work
List I want to work on
The output i need
Try to use this, I'm using cell A20 of the same sheet of the list as my "input value to check" address, you can change it right there on Cells(20, 1)
Sub createDataShapes()
Dim rng As Range
Dim shp, rect As Shape
Set rng = ThisWorkbook.ActiveSheet.Range("A1").CurrentRegion.Find(ThisWorkbook.ActiveSheet.Cells(20, 1).Value)
If Not IsNull(rng.Value) Then
For Each shp In ThisWorkbook.ActiveSheet.Shapes
shp.Delete
Next shp
ThisWorkbook.ActiveSheet.Shapes.AddShape msoShapeRectangle, 100, 100, 100, 100
Set rect = ThisWorkbook.ActiveSheet.Shapes(1)
rect.TextFrame.Characters.Text = rng.Value
End If
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.