VBA, How do i hide entire Rows and entire Columns if there are no data in each respectively? -


i quite new vba. both rows , columns have headers , need hide them if not have data in each respectively.

that should trick

sub main()      sheets("sheet1").activate      dim integer     dim firstcolumn, lastcolumn, firstrow, lastrow integer      firstcolumn = 1     lastcolumn = 10      firstrow = 1     lastrow = 10      ' check if column has data beside header     = firstcolumn lastcolumn         columns(i).hidden = (worksheetfunction.counta(columns(i)) < 2)     next      ' check if row has data beside header     = firstrow lastrow         rows(i).hidden = (worksheetfunction.counta(rows(i)) < 2)     next  end sub 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -