ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ColumnWidth not working... (https://www.excelbanter.com/excel-programming/285885-columnwidth-not-working.html)

BEE

ColumnWidth not working...
 
Here's my code:
rc = 15
ColPlace = 1
For counter = 0 To rc - 1
wb.Worksheets("Sheet1").Columns(ColPlace).ColumnWi dth = 10
ColPlace = ColPlace + 1
Next

I did this cause I couldn't get a range option to work in
this scenario either. How? What am I missing?

Thanks in advance,
B.

BEE

ColumnWidth not working...
 
FIXED:
rc = 15
ColPlace = 1
For counter = 0 To rc - 1
wb.Sheets(1).Columns(ColPlace).ColumnWidth = 10
ColPlace = ColPlace + 1
Next

Thanks tho,
B

-----Original Message-----
Here's my code:
rc = 15
ColPlace = 1
For counter = 0 To rc - 1
wb.Worksheets("Sheet1").Columns(ColPlace).ColumnW idth =

10
ColPlace = ColPlace + 1
Next

I did this cause I couldn't get a range option to work

in
this scenario either. How? What am I missing?

Thanks in advance,
B.
.


Tom Ogilvy

ColumnWidth not working...
 
Sub Tester1()
Set wb = ActiveWorkbook
rc = 15
ColPlace = 1
For counter = 0 To rc - 1
wb.Worksheets("Sheet1").Columns(ColPlace).ColumnWi dth = 10
ColPlace = ColPlace + 1
Next

End Sub


Worked fine for me.

wb.Worksheets("Sheet1").Cells(1,ColPlace).Entireco lumn.ColumnWidth = 10

would also work.

--
Regards,
Tom Ogilvy


"BEE" wrote in message
...
Here's my code:
rc = 15
ColPlace = 1
For counter = 0 To rc - 1
wb.Worksheets("Sheet1").Columns(ColPlace).ColumnWi dth = 10
ColPlace = ColPlace + 1
Next

I did this cause I couldn't get a range option to work in
this scenario either. How? What am I missing?

Thanks in advance,
B.





All times are GMT +1. The time now is 10:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com