Hi everyone!
I am trying to build a table in excel (2010). Ultimately, I would like to be able to have two rectangles within a cell that automatically resize based on different numerical values. The tricky part is, I would like to autoshapes to fall within one cell and not overlap.
I have my customers listed across columns and service lines listed in rows.
Currently I have a rectangle within a cell automatically resize based on the amount of revenue I am doing with that customer (for a specific service). I also have a second rectangle to show how much additional revenue I would like to do with that customer.
However, the autoshapes keep overlapping. Is there a way to stop this from happening? I am using the formula below (that I found on the web) for the rectangles. Is there an easier way for me to be thinking about this? I have attached the sheet. Thanks in advance!
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$101" Then
Shapes("Rectangle 1").Width = Target.Value
End If
If Target.Address = "$C$101" Then
Shapes("Rectangle 2").Width = Target.Value
End If
End Sub
I am trying to build a table in excel (2010). Ultimately, I would like to be able to have two rectangles within a cell that automatically resize based on different numerical values. The tricky part is, I would like to autoshapes to fall within one cell and not overlap.
I have my customers listed across columns and service lines listed in rows.
Currently I have a rectangle within a cell automatically resize based on the amount of revenue I am doing with that customer (for a specific service). I also have a second rectangle to show how much additional revenue I would like to do with that customer.
However, the autoshapes keep overlapping. Is there a way to stop this from happening? I am using the formula below (that I found on the web) for the rectangles. Is there an easier way for me to be thinking about this? I have attached the sheet. Thanks in advance!
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$101" Then
Shapes("Rectangle 1").Width = Target.Value
End If
If Target.Address = "$C$101" Then
Shapes("Rectangle 2").Width = Target.Value
End If
End Sub