Results 1 to 7 of 7

Invalid use of a property-error

Threaded View

  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.

    Private Sub CommandButton1_Click()
     
     Dim bl As Long
     Dim mx As Long
     Dim pw As Range
     Dim LastColumn As Long
     Dim str As Long
     Dim pkSh As Long
     
    
    LastColumn = ActiveSheet.Cells.Find("*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column + 1
     
    
     str = 0
     
     mx = TextBox_maxP * TextBox_PeakS / 100
     bl = TextBox_maxP * TextBox_baseL / 100
     
    Set pw = UsedRange.Find("Power", , , 1, 1).Columns
      
     With Range(pw, pw.End(xlDown))
        If .Value >= mx Then .Value -bl
            str = str + 1
        ElseIf .Value < bl Then .Value = bl
        End If
    End With
        
     Next
     .Range("peak shaving" & LastColumn + 1) = pkSh
     .Range("battery" & LastColumn + 2) = .Value
     Range("K1").Value = str
    
    End Sub
    Attached Files Attached Files

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