excel - Shape placement and shape counter -


i've got few questions shapes in vba excel.

i've got column , column b. shown this.

               b 1 | text    1 5 shapes 2 | blabla       oooo 

i want input text , shapes through userform. if user selects '1', want 1 shape appear @ left of cell in column b. if user selects '3', want 3 shapes appear next each other in column b.

also, if firstly chooses have 3 shapes, , wants change 4 shapes later, have put fourth shape in right place.

all of must still work if change widths of columns.

i googled lot, can't seem find right solution.

this bit works me, of course you'll have modify use own shapes , purpose.

sub drawshapesinplace(shapecell range, numshapes integer, optional gap double = 3#)     dim cellw double     dim cellh double     dim shapew double     dim shapeul double     dim shapetop double     dim shapeh double     dim integer     dim newshape shape      if numshapes < 1         exit sub     end if      cellw = shapecell.width     cellh = shapecell.height     shapew = (cellw / numshapes) - gap     shapeul = shapecell.left     shapetop = shapecell.top     shapeh = cellh      = 1 numshapes         set newshape = activesheet.shapes.addshape(msoshaperectangle, _                                                    shapeul, _                                                    shapetop, _                                                    shapew, _                                                    shapeh)         newshape.line.weight = 1         shapeul = shapeul + gap + shapew     next end sub  sub drawshapes()     call drawshapesinplace(activesheet.range("d9"), 3) end sub 

Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -