Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Need to write function that will change column width based on a condition

Subject says it all, is this a VBA thing or some function I have yet
to discover in the function list. I have no idea how to write this in
VBA. If anyone has any ideas I'd greatly appreciate it. Thanks, Will

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default Need to write function that will change column width based on a condition

Functions, even user defined functions, can only return values to their
calling cells. They can't change cell or worksheet formatting.

You may be able to do what you want with an event macro, but how to
implement it would depend on the condition you want to use.

In article . com,
"dunlapww" wrote:

Subject says it all, is this a VBA thing or some function I have yet
to discover in the function list. I have no idea how to write this in
VBA. If anyone has any ideas I'd greatly appreciate it. Thanks, Will

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Need to write function that will change column width based on a co

You can't change column width inside a function. Only a macro will do it
which means you have either manual activate it or have it in a
Worksheet_Change()
macro.

Sub Worksheet_Change(Target as Range)

if target < 1000 then
Target.ColumnWidth = 15
end if

end sub

"dunlapww" wrote:

Subject says it all, is this a VBA thing or some function I have yet
to discover in the function list. I have no idea how to write this in
VBA. If anyone has any ideas I'd greatly appreciate it. Thanks, Will


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting entries in column based on condition in another column RobertR Excel Worksheet Functions 1 February 8th 07 03:54 PM
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look [email protected] Excel Discussion (Misc queries) 1 December 27th 06 05:47 PM
Change row color based on condition of celss B G Excel Worksheet Functions 3 June 28th 06 08:56 PM
help me getting value of column based on condition amrezzat Excel Worksheet Functions 2 November 12th 05 06:18 PM
Color Change in chart based of condition KRT Charts and Charting in Excel 1 July 1st 05 12:51 PM


All times are GMT +1. The time now is 12:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"