[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 199
  • Last Modified:

In Excel 2010, how can I make a row on a non-active sheet autofit when a cell in that row changes it's value due to a formula referencing the active sheet?

I have a formula in a cell on a non-active sheet.  It has a formula in it that gets it's data from the active sheet.  ie: ='Mysheet1'!A1
When I set up each sheet, I formatted the rows autofit.  When I enter text data in the referenced cell in the active sheet and that data is too long to fit in the cell, it makes the row taller so that all the text can be seen in the cell.  But when I go and look at the non-active sheet, I see that the row height has not changed to accommodate the text.

How can I make it do this?

Right now, I've got a work-around that is not optimal.  When I activate the sheet with the cell that contains the formula, I capture that sheet's Activate event and autofit the rows, but this has a flashing effect.  Even when I disable events, calcs and screen updating.  If it didn't clash, this would probably be ok.

How can I do this and not get that flashing effect?
0
cashonly
Asked:
cashonly
1 Solution
 
Ejgil HedegaardCommented:
A formula does not trigger autofit.
Use the worksheet calculate event on the formula sheet to do it.
The sheet does not have to be active, so no screen flashing.

Private Sub Worksheet_Calculate()
    Rows.AutoFit
End Sub

Open in new window

0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now