close

I have a sheet that uses a bunch of vlookup formulas that are
referencing a hidden tab. Users select a value from a dropdown and all
data related to that value is pulled from the hidden tab. I am trying
to figure out a way to have excel automatically resize the columns
based on the width of the formula result. I am trying to avoid making
the end users resize everything each time they use it. I think I could
figure out a macro to do this, but then users with certain security
settings may not be able to use it. It is a very crammed sheet as it
is, so I am trying to make it as space efficient as possible. Any
ideas?--
Kevin Ward
------------------------------------------------------------------------
Kevin Ward's Profile: www.excelforum.com/member.php...oamp;userid=31417
View this thread: www.excelforum.com/showthread...hreadid=511122You could use a worksheet event.

If you want to try...

Right click on the worksheet tab that should have this behavior. Select view
code and paste this into the code window that you see:

Option Explicit
Private Sub Worksheet_Calculate()
Me.Range(quot;a1,e1,j1quot;).EntireColumn.AutoFit
'or get them all:
me.usedrange.columns.autofit
End Sub

Then back to excel and force a recalculation.
Kevin Ward wrote:
gt;
gt; I have a sheet that uses a bunch of vlookup formulas that are
gt; referencing a hidden tab. Users select a value from a dropdown and all
gt; data related to that value is pulled from the hidden tab. I am trying
gt; to figure out a way to have excel automatically resize the columns
gt; based on the width of the formula result. I am trying to avoid making
gt; the end users resize everything each time they use it. I think I could
gt; figure out a macro to do this, but then users with certain security
gt; settings may not be able to use it. It is a very crammed sheet as it
gt; is, so I am trying to make it as space efficient as possible. Any
gt; ideas?
gt;
gt; --
gt; Kevin Ward
gt; ------------------------------------------------------------------------
gt; Kevin Ward's Profile: www.excelforum.com/member.php...oamp;userid=31417
gt; View this thread: www.excelforum.com/showthread...hreadid=511122

--

Dave Peterson


Thanks for the help Dave. It works perfect. Now if I could just get
our IT department to not have the security settings so high I wouldn't
have to explain to everyone how to change them in order to have macros
work. thanks again for your help!--
Kevin Ward
------------------------------------------------------------------------
Kevin Ward's Profile: www.excelforum.com/member.php...oamp;userid=31417
View this thread: www.excelforum.com/showthread...hreadid=511122

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()