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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 01:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com