I am copying contents of an excel workbook to another workbook.My sheet has few hidden rows which has to be kept hidden in the target workbook as well. I am using the below lines of code to copy the data :
'Set rngCopyRange = wbSource.ActiveSheet.Cells
rngCopyRange.Copy
This works fine in Win 10 64 bit,Office 2013 64bit or Office 2016 32 bit combination But in windows 10 64b , Office 2010 32b or 2013 32b combination,the hidden rows are not hidden. Is this an issue with excel version?Can someboby help me to sort this issue?
How odd. I'm using 2013(64bit) and if I use your code I DO NOT copy across the hidden property of each row to the target.
I think the issue you're getting though is that you're copying across a range that doesn't extend across all columns, so setting the row height (i.e. for all columns) would be counter-intuitive.
If you add .EntireRow
to your copy range, the row height will come across:
Set rngCopyRange = wbSource.ActiveSheet.UsedRange.EntireRow