AutoFit Row Height not working

Rob_010101

Board Regular
Joined
Jul 24, 2017
Messages
198
Office Version
  1. 365
Platform
  1. Windows
Hello,

1705657504373.png


my UNIQUE, FILTER formula is pulling through results but autofit row height is refusing to work.

I have selected all cells and used autofit row height and applied wrap text but it is not working. I have to re-select and apply these every time the formula pulls through a new result. When new information is entered, the UNIQUE, FILTER returns the result with the row collapsed.

The only way I think I can get around this is with a piece of VBA code which selects cells A8:D10, A12:D14 and A16:D45 and applies wrap text and autofit row height to these cells, when the sheet (Objectives annual review) is opened. Here is my sheet:
Annual Review Template DRAFT.xlsx
ABCD
1Annual Objectives Review
2
3Line manager name & job titleDate of annual review
4Second reviewer name & job titleDate of second review
5ObjectivesLine manager reviewEmployee self-reviewStatus
6
7Company-wide objectives
8Employee engagement
9Test test test test test test test test test test test
10
11Employee's personal objectives
12 
13
14
15Role profile objectives
16 
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Objectives Annual Review
Cell Formulas
RangeFormula
A8:A9,A12A8=IFERROR(UNIQUE(FILTER('Setting Annual Objectives'!A9:A11, 'Setting Annual Objectives'!A9:A11<>"")), "")
A16A16=IFERROR(UNIQUE(FILTER('Setting Annual Objectives'!A17:A46, 'Setting Annual Objectives'!A17:A46<>"")), "")
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B3Cell Valuecontains "Choose from list..."textNO
D5:D1048576Cell Valuecontains "Exceeds expectations"textNO
D5:D1048576Cell Valuecontains "Meets expectations"textNO
D5:D1048576Cell Valuecontains "Needs development"textNO
Cells with Data Validation
CellAllowCriteria
D8:D10ListNeeds development, Meets expectations, Exceeds expectations
D12:D14ListNeeds development, Meets expectations, Exceeds expectations
D16:D45ListNeeds development, Meets expectations, Exceeds expectations
D3:D4Datebetween 01/12/2024 and 31/12/2099
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Autofit doesn't work dynamically. That is, if a cell contains a formula that results in text and after a calculation the formula results in a different amount of text, no autofit is triggered. It only works during entering of text, for the cell(s) you are entering the text into. Provided word wrap is turned on and you haven't merged the cells in question.
 
Upvote 0
Thanks, I pretty much figured that.

Could this be automated through VBA to run when the sheet is opened?
 
Upvote 0
If the sheet is called Sheet1, add these lines to your workbook_Open event in the ThisWorkbook module:

VBA Code:
ThisWorkbook.Worksheets("Sheet1").Range("A1:D100").Rows.Autofit
You must adjust the cell address to fit your needs (you can replace it with a named range too). If you want to have this work for all used cells, the code becomes:
VBA Code:
ThisWorkbook.Worksheets("Sheet1").UsedRange.Rows.Autofit
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top