Results 1 to 4 of 4

please help to find out the error in this code?

Threaded View

  1. #1
    Registered User
    Join Date
    10-16-2021
    Location
    egypt
    MS-Off Ver
    2016
    Posts
    75

    please help to find out the error in this code?

    When applying the code using the IF and else rule, it applies to the first condition only and ignores the second condition, labs is a label
    Thank you
    Dim ww As Double, z As Double, s As Double, n As Double, j As Long
    On Error Resume Next
    ww = Application.WorksheetFunction.VLookup(ComboBox5.Value, ThisWorkbook.Sheets("users").Range("y2:z1000"), 2, 0)
    With ListBox1
         For j = 0 To ListBox1.ListCount - 1
    
       If .List(j, 8) <> "" Then z = z + ListBox1.List(j, 6) * ww
                                          s = s + ListBox1.List(j, 6) * ww
                                          n = n + ListBox1.List(j, 6)
    If ComboBox5.Value <> Labs2.Caption Or ComboBox5.Value <> Labs3.Caption Or ComboBox5.Value <> Labs4.Caption _
        Or ComboBox5.Value <> Labs5.Caption Then
             t11.Value = s
       Else
             t11.Value = z
    End If
        tx3.Value = n
        Frame61.Visible = False
    
        Labs7.Caption = ComboBox5.Value
        Next j
    End With
    On Error GoTo 0
    Last edited by saftawy1; 02-16-2023 at 06:28 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 12-19-2022, 10:43 PM
  2. Error With Conditional Formatting Rule Formula
    By Jenn68 in forum Excel General
    Replies: 3
    Last Post: 03-28-2020, 11:29 AM
  3. [SOLVED] Struggling with IF rule for Divide by zero error
    By garegrylls in forum Excel General
    Replies: 3
    Last Post: 11-10-2015, 06:38 AM
  4. How to Find Empirical Rule
    By Karthickrocky in forum Tips and Tutorials
    Replies: 2
    Last Post: 04-03-2015, 09:27 AM
  5. [SOLVED] Looking for a rule to find weekends
    By brians34 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-01-2014, 07:35 PM
  6. Script problem Error in Rule
    By Shakey88 in forum Outlook Programming / VBA / Macros
    Replies: 1
    Last Post: 11-25-2013, 10:17 AM
  7. Indirect validation rule error
    By toclare84 in forum Excel General
    Replies: 7
    Last Post: 10-06-2010, 05:18 AM

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