vba - Macro to adjust an entire row in an Excel table at once -


i need way programatically adjust entire row in excel table based on activecell, irrespective of table it's in or table is. using

activesheet.listobjects(1).listrows(activecell.row - 1).range.select selection.style = "good" 

but upon shifting table down 5 rows, applies action down further 5 rows activecell.

i've tried finding way replace - 1 sort of - .headerrowrange.row nothing happens when activate macro.

you can take advantage of activecell.listobject property. makes more flexible, e.g., if there's 2 tables in worksheet:

sub formatactivetablerow() dim lo excel.listobject  set lo = activecell.listobject if not lo nothing     intersect(activecell.entirerow, lo.range).style = "good" end if end sub 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -