Hello:
I have come up with different logic, please see below #2 Post from me.
Please refer to attached file, Sheet2.
I am using below code to get the rectangle's as shown.
1st the code below set the column width based in row 3.
Then it draws rectangle based on cell data in row 6.
(New logic : Instead of doing column Width, can we draw the rectangle as shown in row 20 down in attached file...
Sub SetColumnWidth()
Columns("B").ColumnWidth = Cells(3, 2).Value
Columns("C").ColumnWidth = Cells(3, 3).Value
Columns("D").ColumnWidth = Cells(3, 4).Value
Columns("E").ColumnWidth = Cells(3, 5).Value
Columns("F").ColumnWidth = Cells(3, 6).Value
Call rmColumnW
End Sub
Sub rmColumnW()
Dim wks As Worksheet
Dim cell As Range
Set wks = ActiveSheet
With wks
For Each cell In .Range("B6", .Cells(6, Columns.Count).End(xlToLeft))
.Shapes.AddShape Type:=msoShapeRectangle, _
Left:=cell.Left, Top:=cell.Offset(1).Top, _
Width:=cell.Value2, Height:=68
ColumnWidth = cell.Value2
'Stop
Next cell
End With
End Sub
I need to modify the code so that each rectangle starts from begining of Column and end little less then end of that column.
I have shown in row 20 down what i am trying to accomplish.
Let me know if you have any questions.
Thanks.
Riz
Bookmarks