excel - How to copy and paste rows with filtering and hidden columns? -


i trying copy , paste row in spreadsheet has filtering , hidden columns. reason, when filtering on, excel doesn't copy hidden columns , when paste row, omitting hidden columns.

is there workaround problem? maybe secret shortcut copies cells in selection, including hidden ones?

thanks.

easy solution here (you loop through sheet , store indexes of hidden columns, think might take more time making copied sheet)

sub copyhiddencolumns()      dim destinationsheet worksheet, tempsheet worksheet, copysheet worksheet     set destinationsheet = thisworkbook.worksheets("destsheet")     set copysheet = thisworkbook.worksheets("copysheet")     copysheet.copy before:=thisworkbook.worksheets(1)     set tempsheet = thisworkbook.worksheets(1)      tempsheet.usedrange.hidden = false     tempsheet.usedrange.copy destination:= destinationsheet.range("a1")     application.displayalerts = false     tempsheet.delete     application.displayalerts = true  end sub 

obviously, can use specified ranges rather usedrange , range("a1"). placed fillers allow code compile


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -