Is there any way of being able to enter a number into a cell and that number
will represent the width of the column? For example, if I wanted the cell to
be a width of 5, I enter that number into a cell in the column?
I hope I've explained that correctly, if not I'll try again!!
Any help will be much appreciated.
Many thanks.
Only with code in say a worksheet_change event, a little like this (Works on
Column A and a value in A1 (Little error checking contained)Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo err:
If Not Application.Intersect(Target, Range(quot;A1quot;)) Is Nothing Then
Application.EnableEvents = False
Columns(quot;A:Aquot;).ColumnWidth = Target.Value
Application.EnableEvents = True
End If
err:
Columns(quot;A:Aquot;).ColumnWidth= 8.38
Application.EnableEvents = True
End Sub
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HISquot;Pricklyflowerquot; gt; wrote in message
...
gt; Is there any way of being able to enter a number into a cell and that
gt; number
gt; will represent the width of the column? For example, if I wanted the cell
gt; to
gt; be a width of 5, I enter that number into a cell in the column?
gt;
gt; I hope I've explained that correctly, if not I'll try again!!
gt;
gt; Any help will be much appreciated.
gt;
gt; Many thanks.
gt;
gt;
Many thanks for this ... however I've never used code before - is this
something that I can do easily or is it best left to the experts?
quot;Nick Hodgequot; wrote:
gt; Only with code in say a worksheet_change event, a little like this (Works on
gt; Column A and a value in A1 (Little error checking contained)
gt;
gt;
gt; Private Sub Worksheet_Change(ByVal Target As Range)
gt; On Error GoTo err:
gt; If Not Application.Intersect(Target, Range(quot;A1quot;)) Is Nothing Then
gt; Application.EnableEvents = False
gt; Columns(quot;A:Aquot;).ColumnWidth = Target.Value
gt; Application.EnableEvents = True
gt; End If
gt; err:
gt; Columns(quot;A:Aquot;).ColumnWidth= 8.38
gt; Application.EnableEvents = True
gt; End Sub
gt; --
gt; HTH
gt; Nick Hodge
gt; Microsoft MVP - Excel
gt; Southampton, England
gt; www.nickhodge.co.uk
gt; HIS
gt;
gt;
gt; quot;Pricklyflowerquot; gt; wrote in message
gt; ...
gt; gt; Is there any way of being able to enter a number into a cell and that
gt; gt; number
gt; gt; will represent the width of the column? For example, if I wanted the cell
gt; gt; to
gt; gt; be a width of 5, I enter that number into a cell in the column?
gt; gt;
gt; gt; I hope I've explained that correctly, if not I'll try again!!
gt; gt;
gt; gt; Any help will be much appreciated.
gt; gt;
gt; gt; Many thanks.
gt; gt;
gt; gt;
gt;
gt;
gt;
It's up to you, it will work unaltered and you could start on the learning
process or employ someone to do it for you
You can right-click on a sheet tab and select view code, enter the code I
gave you in the resulting window and the code will run on that sheet
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HISquot;Pricklyflowerquot; gt; wrote in message
...
gt; Many thanks for this ... however I've never used code before - is this
gt; something that I can do easily or is it best left to the experts?
gt;
gt; quot;Nick Hodgequot; wrote:
gt;
gt;gt; Only with code in say a worksheet_change event, a little like this (Works
gt;gt; on
gt;gt; Column A and a value in A1 (Little error checking contained)
gt;gt;
gt;gt;
gt;gt; Private Sub Worksheet_Change(ByVal Target As Range)
gt;gt; On Error GoTo err:
gt;gt; If Not Application.Intersect(Target, Range(quot;A1quot;)) Is Nothing Then
gt;gt; Application.EnableEvents = False
gt;gt; Columns(quot;A:Aquot;).ColumnWidth = Target.Value
gt;gt; Application.EnableEvents = True
gt;gt; End If
gt;gt; err:
gt;gt; Columns(quot;A:Aquot;).ColumnWidth= 8.38
gt;gt; Application.EnableEvents = True
gt;gt; End Sub
gt;gt; --
gt;gt; HTH
gt;gt; Nick Hodge
gt;gt; Microsoft MVP - Excel
gt;gt; Southampton, England
gt;gt; www.nickhodge.co.uk
gt;gt; HIS
gt;gt;
gt;gt;
gt;gt; quot;Pricklyflowerquot; gt; wrote in
gt;gt; message
gt;gt; ...
gt;gt; gt; Is there any way of being able to enter a number into a cell and that
gt;gt; gt; number
gt;gt; gt; will represent the width of the column? For example, if I wanted the
gt;gt; gt; cell
gt;gt; gt; to
gt;gt; gt; be a width of 5, I enter that number into a cell in the column?
gt;gt; gt;
gt;gt; gt; I hope I've explained that correctly, if not I'll try again!!
gt;gt; gt;
gt;gt; gt; Any help will be much appreciated.
gt;gt; gt;
gt;gt; gt; Many thanks.
gt;gt; gt;
gt;gt; gt;
gt;gt;
gt;gt;
gt;gt;
Many thanks Nick, I'll have a go at doing this tomorrow. Thanks ever so much
for all your help, much appreciated.
quot;Nick Hodgequot; wrote:
gt; It's up to you, it will work unaltered and you could start on the learning
gt; process or employ someone to do it for you
gt;
gt; You can right-click on a sheet tab and select view code, enter the code I
gt; gave you in the resulting window and the code will run on that sheet
gt;
gt; --
gt; HTH
gt; Nick Hodge
gt; Microsoft MVP - Excel
gt; Southampton, England
gt; www.nickhodge.co.uk
gt; HIS
gt;
gt;
gt; quot;Pricklyflowerquot; gt; wrote in message
gt; ...
gt; gt; Many thanks for this ... however I've never used code before - is this
gt; gt; something that I can do easily or is it best left to the experts?
gt; gt;
gt; gt; quot;Nick Hodgequot; wrote:
gt; gt;
gt; gt;gt; Only with code in say a worksheet_change event, a little like this (Works
gt; gt;gt; on
gt; gt;gt; Column A and a value in A1 (Little error checking contained)
gt; gt;gt;
gt; gt;gt;
gt; gt;gt; Private Sub Worksheet_Change(ByVal Target As Range)
gt; gt;gt; On Error GoTo err:
gt; gt;gt; If Not Application.Intersect(Target, Range(quot;A1quot;)) Is Nothing Then
gt; gt;gt; Application.EnableEvents = False
gt; gt;gt; Columns(quot;A:Aquot;).ColumnWidth = Target.Value
gt; gt;gt; Application.EnableEvents = True
gt; gt;gt; End If
gt; gt;gt; err:
gt; gt;gt; Columns(quot;A:Aquot;).ColumnWidth= 8.38
gt; gt;gt; Application.EnableEvents = True
gt; gt;gt; End Sub
gt; gt;gt; --
gt; gt;gt; HTH
gt; gt;gt; Nick Hodge
gt; gt;gt; Microsoft MVP - Excel
gt; gt;gt; Southampton, England
gt; gt;gt; www.nickhodge.co.uk
gt; gt;gt; HIS
gt; gt;gt;
gt; gt;gt;
gt; gt;gt; quot;Pricklyflowerquot; gt; wrote in
gt; gt;gt; message
gt; gt;gt; ...
gt; gt;gt; gt; Is there any way of being able to enter a number into a cell and that
gt; gt;gt; gt; number
gt; gt;gt; gt; will represent the width of the column? For example, if I wanted the
gt; gt;gt; gt; cell
gt; gt;gt; gt; to
gt; gt;gt; gt; be a width of 5, I enter that number into a cell in the column?
gt; gt;gt; gt;
gt; gt;gt; gt; I hope I've explained that correctly, if not I'll try again!!
gt; gt;gt; gt;
gt; gt;gt; gt; Any help will be much appreciated.
gt; gt;gt; gt;
gt; gt;gt; gt; Many thanks.
gt; gt;gt; gt;
gt; gt;gt; gt;
gt; gt;gt;
gt; gt;gt;
gt; gt;gt;
gt;
gt;
gt;
- Oct 22 Sun 2006 20:09
Column Widths
close
全站熱搜
留言列表
發表留言