+ Reply to Thread
Results 1 to 7 of 7

Invalid use of a property-error

  1. #1
    Forum Contributor
    Join Date
    05-05-2020
    Location
    Germany
    MS-Off Ver
    2013
    Posts
    100

    Invalid use of a property-error

    Hi,

    I have this that should take the column and check if each value are greater than mx, if so then subtract bl from them and return them in new column. Then check them again and if Value is smaller than bl then change that value to bl and return in next column.

    but it doesn't work and I keep getting "Invalid use of a property" error.

    p.s. str supposted to count how many values are greater than mx.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Invalid use of a property-error

    Hi
    Try
    Please Login or Register  to view this content.

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Invalid use of a property-error

    Hi (T_T),

    you cannot compare the values of cells in a range in one go (except using Evaluate) but should loop through the cells instead. And I doubt the next error would occur as rows 4 and 5 are text.
    Later on in the code you refer to a with statement which is not provided as well as no information about what ranges "peak shaving" and "battery" refer to and what pkSh is.

    Maybe you should give this code a try:
    Please Login or Register  to view this content.
    Please be informed that the last For...Next loop clears the contents of the userform if you want further entries to be made (or simply use Unload.Me for just one entry).

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Invalid use of a property-error

    Hello.
    Is the 'Maximum Power' value calculated as the largest value in column C or will you write it "by hand"?

  5. #5
    Forum Contributor
    Join Date
    05-05-2020
    Location
    Germany
    MS-Off Ver
    2013
    Posts
    100

    Re: Invalid use of a property-error

    Quote Originally Posted by HaHoBe View Post
    Hi (T_T),

    you cannot compare the values of cells in a range in one go (except using Evaluate) but should loop through the cells instead. And I doubt the next error would occur as rows 4 and 5 are text.
    Later on in the code you refer to a with statement which is not provided as well as no information about what ranges "peak shaving" and "battery" refer to and what pkSh is.

    Maybe you should give this code a try:
    Please Login or Register  to view this content.
    Please be informed that the last For...Next loop clears the contents of the userform if you want further entries to be made (or simply use Unload.Me for just one entry).

    Ciao,
    Holger
    Thanks
    What does this part do?
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    05-05-2020
    Location
    Germany
    MS-Off Ver
    2013
    Posts
    100

    Re: Invalid use of a property-error

    Quote Originally Posted by beyond Excel View Post
    Hello.
    Is the 'Maximum Power' value calculated as the largest value in column C or will you write it "by hand"?
    The user will give the max.

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Invalid use of a property-error

    Hi (T_T),

    Please Login or Register  to view this content.
    Set the range down 2 rows and resize the range to be 2 rows short of the original range (exclude the headers) and match the number of columns.

    BTW the first error was raised by
    Please Login or Register  to view this content.
    as an = was missing. Adding this will lead to a new error as your If-clauses are different from what the compiler expects.

    Ciao,
    Holger

+ 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. Could not set the RowSource property. Invalid Property Value error when switching bet
    By sathyaganapathi in forum Access Programming / VBA / Macros
    Replies: 6
    Last Post: 08-03-2021, 06:54 AM
  2. [SOLVED] Error 381Could not set the List property. Invalid property array index
    By desonny in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-16-2020, 08:33 AM
  3. Runtime error 381: Could not set the list property.Invalid property array index
    By rohith4prithvi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2014, 10:24 PM
  4. Run-time Error '380': Could not set the RowSource property. Invalid property value
    By Rem0ram in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-26-2013, 03:57 PM
  5. [SOLVED] Excel run-time error '381': Could not set the List property. Invalid property array index
    By eemiller1997 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-20-2012, 12:48 PM
  6. Replies: 2
    Last Post: 06-11-2012, 03:03 PM
  7. Runtime Error 380 – Could not set the list property. Invalid property value
    By BernzG in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2005, 05:10 PM

Tags for this Thread

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