View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Create a macro which takes a column name and width and sets the co

Enter the cell address in one cell and the width to the cell to the right.
Make the active cell the left of the two cells. for example below make cell
E1 the active cell when calling my macro below

E1 F1
A1 2

The above will make cell A1 columnwidth 2
For a different sheet

E1 F1
sheet2!A1 2


Then use this macro

Sub changewidth()

CellAddress = ActiveCell.Text
Cellwidth = ActiveCell.Offset(0, 1).Value

Range(CellAddress).ColumnWidth = Cellwidth

End Sub



"Ag" wrote:

I want to create a macro whcich can be calles from a different sheet
and would change the column with to the parameter passed for the
column for whcich it is pased.The column name and width may be
mentioned in the second sheet from whcich they are read by the macro.

Aj