PC Review


Reply
Thread Tools Rate Thread

Change ColumnWidth for Multiple Columns?

 
 
AJ Master
Guest
Posts: n/a
 
      11th Apr 2007
I need to be able to change the column width on multiple columns (all
next to each other) on one sheet (i.e. codename: sheet10) based on
user data selected from a combobox on sheet1.

I have tried using this but it always fails, so I would really
appreciate any help on fixing it:

with sheet10 'codename for sheet
.unprotect
.columns(4,zColCount).columnwidth=dblColWidth ' col D thru # of
columns entered
.protect
end with

Thanks again....AJ

 
Reply With Quote
 
 
 
 
Gary Keramidas
Guest
Posts: n/a
 
      11th Apr 2007
how about this? (i added values manually because i don't have your code)

Sub test()
zcolcount = 8
dblColWidth = 12
With Sheet10 'codename for sheet
.Unprotect
.Columns(4).Resize(1, zcolcount).ColumnWidth = dblColWidth '
.Protect
End With

End Sub


--


Gary


"AJ Master" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I need to be able to change the column width on multiple columns (all
> next to each other) on one sheet (i.e. codename: sheet10) based on
> user data selected from a combobox on sheet1.
>
> I have tried using this but it always fails, so I would really
> appreciate any help on fixing it:
>
> with sheet10 'codename for sheet
> .unprotect
> .columns(4,zColCount).columnwidth=dblColWidth ' col D thru # of
> columns entered
> .protect
> end with
>
> Thanks again....AJ
>



 
Reply With Quote
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      11th Apr 2007
One way is to do it like this:

with sheet10 'codename for sheet
.unprotect
.Range(Cells(1, 4), Cells(1, 4 + zcolcount)).ColumnWidth = dblColWidth
.protect
end with




--
Hope that helps.

Vergel Adriano


"AJ Master" wrote:

> I need to be able to change the column width on multiple columns (all
> next to each other) on one sheet (i.e. codename: sheet10) based on
> user data selected from a combobox on sheet1.
>
> I have tried using this but it always fails, so I would really
> appreciate any help on fixing it:
>
> with sheet10 'codename for sheet
> .unprotect
> .columns(4,zColCount).columnwidth=dblColWidth ' col D thru # of
> columns entered
> .protect
> end with
>
> Thanks again....AJ
>
>

 
Reply With Quote
 
AJ Master
Guest
Posts: n/a
 
      11th Apr 2007
On Apr 11, 12:51 pm, "Gary Keramidas" <GKeramidasATmsn.com> wrote:
> how about this? (i added values manually because i don't have your code)
>
> Sub test()
> zcolcount = 8
> dblColWidth = 12
> With Sheet10 'codename for sheet
> .Unprotect
> .Columns(4).Resize(1, zcolcount).ColumnWidth = dblColWidth '
> .Protect
> End With
>
> End Sub
>
> --
>
> Gary
>
> "AJ Master" <amitmas...@gmail.com> wrote in message
>
> news:(E-Mail Removed)...
>
> >I need to be able to change the column width on multiple columns (all
> > next to each other) on one sheet (i.e. codename: sheet10) based on
> > user data selected from a combobox on sheet1.

>
> > I have tried using this but it always fails, so I would really
> > appreciate any help on fixing it:

>
> > with sheet10 'codename for sheet
> > .unprotect
> > .columns(4,zColCount).columnwidth=dblColWidth ' col D thru # of
> > columns entered
> > .protect
> > end with

>
> > Thanks again....AJ


Gary,

Yes, thanks that worked perfectly.

AJ

 
Reply With Quote
 
AJ Master
Guest
Posts: n/a
 
      11th Apr 2007
On Apr 11, 1:00 pm, Vergel Adriano
<VergelAdri...@discussions.microsoft.com> wrote:
> One way is to do it like this:
>
> with sheet10 'codename for sheet
> .unprotect
> .Range(Cells(1, 4), Cells(1, 4 + zcolcount)).ColumnWidth = dblColWidth
> .protect
> end with
>
> --
> Hope that helps.
>
> Vergel Adriano
>
> "AJ Master" wrote:
> > I need to be able to change the column width on multiple columns (all
> > next to each other) on one sheet (i.e. codename: sheet10) based on
> > user data selected from a combobox on sheet1.

>
> > I have tried using this but it always fails, so I would really
> > appreciate any help on fixing it:

>
> > with sheet10 'codename for sheet
> > .unprotect
> > .columns(4,zColCount).columnwidth=dblColWidth ' col D thru # of
> > columns entered
> > .protect
> > end with

>
> > Thanks again....AJ


Vergel,

Thanks, your code worked as well. I appreciate everyones help with
this.

AJ

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Split form vs change ColumnWidth =?Utf-8?B?Sm9zZSBQZXJkaWdhbw==?= Microsoft Access Forms 1 15th Jun 2011 06:09 PM
Multiple wrksheets same columns globally change order of columns? Change order of columns multiple wkshts Microsoft Excel Programming 1 11th Sep 2008 06:04 PM
Columnwidth change not correct Mike Microsoft Excel Programming 5 23rd Jun 2007 06:18 PM
Columns.ColumnWidth error...sometimes =?Utf-8?B?VF9vX25feQ==?= Microsoft Excel Programming 0 11th Feb 2007 12:31 AM
How To: Change ColumnWidth AT runtime on DataGridView in VB.net 2005 Eric Fortin Microsoft VB .NET 2 16th Mar 2006 01:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:44 PM.