I am not sure if my approach is correct or not. I have copied some named ranges from one workbook to another. This seems to work ok.
The problem is that within the named ranges that I am copying, there are some merged cells and some cells with wrapped text. The row heights do not seem to copy with the code
So, I am attempting to set the row height to autofit based on the largest height needed. I am using the code below.
The code appears to only look at column A to determine what the row height should be. However, in some cases the amount of text in column C may be the most so it should expose that text.
My next thought would be that I should loop through all possible columns and rows in my final sheet. I know how to do this but I am thinking that once it gets to Column C, it will expand the row height to actual and then in Column D it will bring it back to a standard Autofit of 15 again instead of something like 50 for Column C.
So I was wondering if there was an easier way?
An example of text in a cell like C1 would be
But A1, B1, D1 would have nothing, etc. until J1 which might have one line of text and at present only goes over to column L in the full block.
Each named ranged being copied in below each other should have the same number of columns, but the rows will need to be varying heights based on the maximum text in any cell in the row.
I hope I have explained this correctly. Any ideas are greatly appreciated. TIA, rasinc
The problem is that within the named ranges that I am copying, there are some merged cells and some cells with wrapped text. The row heights do not seem to copy with the code
Code:
wbPickTicket.Sheets(strSheetName).Range("A1").PasteSpecial Paste:=xlPasteAll
So, I am attempting to set the row height to autofit based on the largest height needed. I am using the code below.
Code:
For x = 1 To lngLastRow + 10
Range("A" & x).EntireRow.AutoFit
Next x
The code appears to only look at column A to determine what the row height should be. However, in some cases the amount of text in column C may be the most so it should expose that text.
My next thought would be that I should loop through all possible columns and rows in my final sheet. I know how to do this but I am thinking that once it gets to Column C, it will expand the row height to actual and then in Column D it will bring it back to a standard Autofit of 15 again instead of something like 50 for Column C.
So I was wondering if there was an easier way?
An example of text in a cell like C1 would be
ABC Company Inc.
123 Anywhere St.
Somewhere, Missouri 12345
Tel: (555) 555-5555 Fax: (555) 555-5577
But A1, B1, D1 would have nothing, etc. until J1 which might have one line of text and at present only goes over to column L in the full block.
Each named ranged being copied in below each other should have the same number of columns, but the rows will need to be varying heights based on the maximum text in any cell in the row.
I hope I have explained this correctly. Any ideas are greatly appreciated. TIA, rasinc