mysql - Adding Checkboxes next to pivot table that are added until the last row of information in the pivot table -


dear all: need add check boxes column a, left of pivot table, starting form column b column d. want check boxes linked extreme right of pivot table, column e.

i have found code that. limited specific range ("a4:a9"). wanted code able add check boxes regardless of length of pivot table dynamically in case grows in other words last row.

please find attached whole code have

sub addcheckbox()     dim cell range      delcheckbox  'do delete macro     'or delete checkboxes in worksheet     ' activesheet.checkboxes.delete     dim myrow long      lastrow = cells.find("*", range("a1"), xlvalues, , xlbyrows, xlprevious).row      each cell in range("a4:a9")         activesheet.checkboxes.add(cell.left, _             cell.top, cell.width, cell.height)             .linkedcell = cell.offset(, 4).address(external:=true)             .interior.colorindex = 37   'or  xlnone or xlautomatic             .caption = ""             '.border.weight = xlthin         end     next      range("a4:a9")         .rows.rowheight = 15     end end sub 

sub delcheckbox()     each cell in range("a4:a9")         worksheets("analysis").checkboxes.delete     next end sub 

i have found code identifies last row. however, must doing wrong because doesn't seem work when try insert rest of code. in fact, don't know need insert work properly. me please identify need do?

many in advance help.

try using lastrow = activesheet.range("a" & activesheet.rows.count).end(xlup).row find last row in column instead of method. change range("a4:a9") range("a4:a" & lastrow) anywhere referenced in code (also change 4 first row of used cells in column a)

source

update after comments below

i've modified code above. yours wasn't working deleting checkboxes before 'counting' them. hence adding them rows 1 4. if change norow column e constant column in sheet want to.

sub addcheckbox()     dim cell     dim norow integer: dim firstrow integer     dim ws worksheet      set ws = thisworkbook.worksheets("analysis")     ws         .checkboxes.delete         ' change `e` column checkboxes aligning         norow = .range("e" & .rows.count).end(xlup).row     end      each cell in range("a4:a" & norow)         ws.checkboxes.add(cell.left, _             cell.top, cell.width, cell.height)             .linkedcell = cell.offset(, 4).address(external:=true)             .interior.colorindex = 37   'or  xlnone or xlautomatic             .caption = ""             '.border.weight = xlthin         end     next      ws.range("a4:a" & norow).cells         .rows.rowheight = 15     end end sub 

Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -