+ Reply to Thread
Results 1 to 15 of 15

Cannot assign the NumberFormat property of the Range class

  1. #1
    Registered User
    Join Date
    01-02-2021
    Location
    Úbeda (Spain)
    MS-Off Ver
    Microsoft Office 365
    Posts
    46

    Cannot assign the NumberFormat property of the Range class

    Good afternoon.

    I'm trying to format some cells, but I get the error that you can see in the title: Cannot assign the NumberFormat property of the Range class

    I don't know what I'm doing wrong, if someone could guide me.

    Please Login or Register  to view this content.
    Thanks.
    Last edited by zelarra821; 03-21-2023 at 03:23 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,630

    Re: Cannot assign the NumberFormat property of the Range class

    HTML tags don't work very well. Please use Code Tags. As it stands, we can't see your code.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    01-02-2021
    Location
    Úbeda (Spain)
    MS-Off Ver
    Microsoft Office 365
    Posts
    46

    Re: Cannot assign the NumberFormat property of the Range class

    I don't know how to put it in any other way than that so that it can be seen.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,630

    Re: Cannot assign the NumberFormat property of the Range class

    Take out the .Text. .NumberFormat can't be applied to Text.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,630

    Re: Cannot assign the NumberFormat property of the Range class

    I don't know how to put it in any other way than that so that it can be seen.
    Administrative Note:


    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)

  6. #6
    Registered User
    Join Date
    01-02-2021
    Location
    Úbeda (Spain)
    MS-Off Ver
    Microsoft Office 365
    Posts
    46

    Re: Cannot assign the NumberFormat property of the Range class

    Not even with those, it keeps giving me the error.

  7. #7
    Registered User
    Join Date
    01-02-2021
    Location
    Úbeda (Spain)
    MS-Off Ver
    Microsoft Office 365
    Posts
    46

    Re: Cannot assign the NumberFormat property of the Range class

    It's alredy done it

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,630

    Re: Cannot assign the NumberFormat property of the Range class

    The Code tags are to fix your post, not the problem. See post #4.

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,630

    Re: Cannot assign the NumberFormat property of the Range class

    This is getting silly. Post your workbook.


    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file and a mocked up solution.

  10. #10
    Registered User
    Join Date
    01-02-2021
    Location
    Úbeda (Spain)
    MS-Off Ver
    Microsoft Office 365
    Posts
    46

    Re: Cannot assign the NumberFormat property of the Range class

    You got it
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    01-02-2021
    Location
    Úbeda (Spain)
    MS-Off Ver
    Microsoft Office 365
    Posts
    46

    Re: Cannot assign the NumberFormat property of the Range class

    If by the way you suggest me how I can improve the code to optimize it, much better.

  12. #12
    Registered User
    Join Date
    01-02-2021
    Location
    Úbeda (Spain)
    MS-Off Ver
    Microsoft Office 365
    Posts
    46

    Re: Cannot assign the NumberFormat property of the Range class

    The sub is named Formatear

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,630

    Re: Cannot assign the NumberFormat property of the Range class

    This is what I meant:

    Please Login or Register  to view this content.
    I can't test this as I don't know how to drive it. You do know that having the Worksheet_Activate Event handlers can mean you can't copy between sheets.

  14. #14
    Registered User
    Join Date
    01-02-2021
    Location
    Úbeda (Spain)
    MS-Off Ver
    Microsoft Office 365
    Posts
    46

    Re: Cannot assign the NumberFormat property of the Range class

    https://www.dropbox.com/s/la8b5okq7v...Video.avi?dl=0

    If you press the Formatear button, it will give you the error. If you put two dates in D4 and E4, and press Formatear again, it will give you the error. It's on line 105 of the module.

  15. #15
    Registered User
    Join Date
    01-02-2021
    Location
    Úbeda (Spain)
    MS-Off Ver
    Microsoft Office 365
    Posts
    46

    Re: Cannot assign the NumberFormat property of the Range class

    Solved. There was a problem with protected sheets. Thanks to all.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Unable to set the NumberFormat property of the PivotField Class
    By inspector-71 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-13-2022, 04:22 AM
  2. [SOLVED] Can't Assign to Read-Only Property; Compile Error on Assigning Property to Class.
    By Dal123 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-15-2018, 08:09 AM
  3. Replies: 5
    Last Post: 06-19-2017, 08:04 AM
  4. [SOLVED] Hide columns based on cell value - Unable to set hidden range property of Range Class
    By trillium in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-13-2012, 11:13 PM
  5. Using a range object as a property in a class
    By Lazhal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-03-2010, 08:07 PM
  6. Error: Cannot Set Range Class Property
    By 2hOt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2006, 07:55 AM
  7. Replies: 2
    Last Post: 10-17-2005, 04:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1