ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell Formatting Failure (https://www.excelbanter.com/excel-programming/354336-cell-formatting-failure.html)

Wired Hosting News

Cell Formatting Failure
 
Can anyone tell me why this fails

Sub SizeAndFormat(ws As Worksheet)

With ws.Columns("D:D")

.ColumnWidth = 12
.Font.Size = 8
.Style = "Currency" - This Line fails

'other code...

end sub

There is not an error code associated. The code just exits the function and
returns to its' calling point. If I comment out this line, everything else
works.

Any ideas?



Dave Peterson

Cell Formatting Failure
 
Do you still have a style of currency in that workbook?

I got a runtime error of 450--wrong number of arguments or invalid property
assignment

After I deleted that currency style (and ran the code).

If you try Format|Style and currency isn't available, then try this.

Start a new workbook.
Check to see if currency is in that new workbook (styles live in workbooks).

If it's there, you can activate the problem workbook
format|style|Merge and "steal" that currency style from that new workbook.

If the style isn't that new workbook, you may have deleted that style from your
Book.xlt template workbook.

Wired Hosting News wrote:

Can anyone tell me why this fails

Sub SizeAndFormat(ws As Worksheet)

With ws.Columns("D:D")

.ColumnWidth = 12
.Font.Size = 8
.Style = "Currency" - This Line fails

'other code...

end sub

There is not an error code associated. The code just exits the function and
returns to its' calling point. If I comment out this line, everything else
works.

Any ideas?


--

Dave Peterson

Wired Hosting News

Cell Formatting Failure
 
Thanks Dave, You hit it on the nose. Funny, I never realized these styles
live in the books. I always thought they were intrinsic.

"Dave Peterson" wrote in message
...
Do you still have a style of currency in that workbook?

I got a runtime error of 450--wrong number of arguments or invalid
property
assignment

After I deleted that currency style (and ran the code).

If you try Format|Style and currency isn't available, then try this.

Start a new workbook.
Check to see if currency is in that new workbook (styles live in
workbooks).

If it's there, you can activate the problem workbook
format|style|Merge and "steal" that currency style from that new workbook.

If the style isn't that new workbook, you may have deleted that style from
your
Book.xlt template workbook.

Wired Hosting News wrote:

Can anyone tell me why this fails

Sub SizeAndFormat(ws As Worksheet)

With ws.Columns("D:D")

.ColumnWidth = 12
.Font.Size = 8
.Style = "Currency" - This Line fails

'other code...

end sub

There is not an error code associated. The code just exits the function
and
returns to its' calling point. If I comment out this line, everything
else
works.

Any ideas?


--

Dave Peterson






All times are GMT +1. The time now is 06:03 PM.

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