Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Unable to change NumberFormat Property

I have a sheet where I would like to adjust the format of the cell where a
user enters data, based on the entry type they have selected. The sheet is
protected, and the following If statement is contained within a macro for the
Change event of a combo box, and also nested within a pair of statements to
first unprotect, then protect the sheet.

If Stop_Loss_Limit_Type.Text = "$ Amount" Then

Sheets("Entry").Protect AllowFormattingCells:=True
Range("Min_entry").NumberFormat = "Currency"
Sheets("Entry").Protect AllowFormattingCells:=False

End If

When this is run, I get a run-time error 1004, with error message "Unable to
set the NumberFormat property of the Range class". Any advice on why this
might be welcomed - as far as I am aware setting allowformattingcells
property to true should allow me to change the number format.

Thanks
Geoff
--
There are 10 types of people in the world - those who understand binary and
those who don't.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Unable to change NumberFormat Property

I think you might have to be specific:

NumberFormat = "$#,##0.00_);[Red]($#,##0.00)"


"Geoff" wrote:

I have a sheet where I would like to adjust the format of the cell where a
user enters data, based on the entry type they have selected. The sheet is
protected, and the following If statement is contained within a macro for the
Change event of a combo box, and also nested within a pair of statements to
first unprotect, then protect the sheet.

If Stop_Loss_Limit_Type.Text = "$ Amount" Then

Sheets("Entry").Protect AllowFormattingCells:=True
Range("Min_entry").NumberFormat = "Currency"
Sheets("Entry").Protect AllowFormattingCells:=False

End If

When this is run, I get a run-time error 1004, with error message "Unable to
set the NumberFormat property of the Range class". Any advice on why this
might be welcomed - as far as I am aware setting allowformattingcells
property to true should allow me to change the number format.

Thanks
Geoff
--
There are 10 types of people in the world - those who understand binary and
those who don't.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Unable to change NumberFormat Property

Exactly - thanks very much for that, I thought I was going mad :)

--
There are 10 types of people in the world - those who understand binary and
those who don''t.


"JLGWhiz" wrote:

I think you might have to be specific:

NumberFormat = "$#,##0.00_);[Red]($#,##0.00)"


"Geoff" wrote:

I have a sheet where I would like to adjust the format of the cell where a
user enters data, based on the entry type they have selected. The sheet is
protected, and the following If statement is contained within a macro for the
Change event of a combo box, and also nested within a pair of statements to
first unprotect, then protect the sheet.

If Stop_Loss_Limit_Type.Text = "$ Amount" Then

Sheets("Entry").Protect AllowFormattingCells:=True
Range("Min_entry").NumberFormat = "Currency"
Sheets("Entry").Protect AllowFormattingCells:=False

End If

When this is run, I get a run-time error 1004, with error message "Unable to
set the NumberFormat property of the Range class". Any advice on why this
might be welcomed - as far as I am aware setting allowformattingcells
property to true should allow me to change the number format.

Thanks
Geoff
--
There are 10 types of people in the world - those who understand binary and
those who don't.

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
Excel automation through .NET Interop: NumberFormat property looks like NumberFormatLocal martin durtschi Excel Programming 4 May 13th 14 07:39 PM
NumberFormat property JohnP[_2_] Setting up and Configuration of Excel 1 March 25th 11 01:00 PM
Unable to set NumberFormat property of the PivotField class Seb[_5_] Excel Programming 0 December 6th 04 04:04 PM
Unable to set NumberFormat property of the PivotField class Seb[_5_] Excel Programming 0 December 6th 04 03:50 PM
Unable to set the NumberFormat Property of the Range Class - ERROR Jon Delano Excel Programming 3 November 10th 04 07:33 PM


All times are GMT +1. The time now is 02:14 AM.

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"