Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default vba code...... on update...........

Hi,

I have a pivot table, and on selection i want it to format the width of the
columns. The problem i'm having is that i can only set the widths to all the
same. Im wanting column A & B wider than the rest. The code i have used so
far is

Range("C:Z").Select
Selection.ColumnWidth = 14
Range("A:B").Select
Selection.ColumnWidth = 31

but this some how sets all the coloumns to 31????????

Any help will be helpful as i am new to vba, thanks

Paul
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default vba code...... on update...........

ALL SORTED........... I had a merged cell in there which was causing some
problems,

thanks

"CRANSWICK, P" wrote:

Hi,

I have a pivot table, and on selection i want it to format the width of the
columns. The problem i'm having is that i can only set the widths to all the
same. Im wanting column A & B wider than the rest. The code i have used so
far is

Range("C:Z").Select
Selection.ColumnWidth = 14
Range("A:B").Select
Selection.ColumnWidth = 31

but this some how sets all the coloumns to 31????????

Any help will be helpful as i am new to vba, thanks

Paul

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default vba code...... on update...........

I think we need to see abit more of your code. The snippet you provided does
work for me.
--
Best wishes,

Jim


"CRANSWICK, P" wrote:

Hi,

I have a pivot table, and on selection i want it to format the width of the
columns. The problem i'm having is that i can only set the widths to all the
same. Im wanting column A & B wider than the rest. The code i have used so
far is

Range("C:Z").Select
Selection.ColumnWidth = 14
Range("A:B").Select
Selection.ColumnWidth = 31

but this some how sets all the coloumns to 31????????

Any help will be helpful as i am new to vba, thanks

Paul

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default vba code...... on update...........

Glad to hear you got it sorted. However, for future reference, it is
good coding practice not to make a selection if you don't have to.
You can change the column width by just using the Range object.
Range("C:Z").ColumnWidth = 14
Range("A:B").ColumnWidth = 31

CRANSWICK, P wrote:
ALL SORTED........... I had a merged cell in there which was causing some
problems,

thanks

"CRANSWICK, P" wrote:

Hi,

I have a pivot table, and on selection i want it to format the width of the
columns. The problem i'm having is that i can only set the widths to all the
same. Im wanting column A & B wider than the rest. The code i have used so
far is

Range("C:Z").Select
Selection.ColumnWidth = 14
Range("A:B").Select
Selection.ColumnWidth = 31

but this some how sets all the coloumns to 31????????

Any help will be helpful as i am new to vba, thanks

Paul


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
update code Lost Excel Discussion (Misc queries) 0 January 16th 09 04:53 AM
How can I update VBA code in a module that is running my VBA code? Gummy Excel Programming 3 June 12th 07 06:26 PM
code to update a macro Paul Excel Programming 1 June 16th 04 02:59 AM
Any way to update links tru VBA code? nrage21[_47_] Excel Programming 1 March 5th 04 05:32 PM
Update VBA Module Code Todd Huttenstine[_2_] Excel Programming 1 December 27th 03 10:15 AM


All times are GMT +1. The time now is 06:26 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"