PDA

View Full Version : VBA for Excel Kanban tool



RubyLani
04-15-2022, 07:42 AM
Hello, I am try to write a macro which creates a shape based on a row being filled in a table.

So it should be something like "If Table1 active row is not empty then addshape"

Can someone help me please?

georgiboy
04-19-2022, 01:27 AM
Hi RubyLani,

Welcome to the forum.

Below is an example of looping through the cells in the first column of a table and checking if they are empty or not. If the cell is not empty then it will create the shape on the second sheet.

Sub test()
Dim rCell As Range, dbRng As Range

Set dbRng = ActiveSheet.ListObjects("Table1").DataBodyRange.Columns(1)

For Each rCell In dbRng.Cells
If Not rCell Is Nothing Then
Sheet2.Shapes.AddShape msoShapeRectangle, 135, 89, 90, 40
End If
Next rCell
End Sub