+ Reply to Thread
Results 1 to 6 of 6

Return Value to Textboxes based on 2 criterias

Hybrid View

Khanzaki Return Value to Textboxes... 09-07-2024, 11:32 AM
mjr veverka Re: Return Value to Textboxes... 09-07-2024, 02:21 PM
protonLeah Re: Return Value to Textboxes... 09-07-2024, 04:20 PM
Sintek Re: Return Value to Textboxes... 09-08-2024, 07:05 AM
Khanzaki Re: Return Value to Textboxes... 09-08-2024, 11:12 AM
Sintek Re: Return Value to Textboxes... 09-08-2024, 11:50 AM
  1. #1
    Forum Contributor
    Join Date
    10-10-2012
    Location
    Mumbai,India
    MS-Off Ver
    Microsoft Excel 2007
    Posts
    156

    Cool Return Value to Textboxes based on 2 criterias

    Respected members;
    I currently have a code which enables me to retrieve data from sheet1 based on value in combo box rec2 ;
    However I am looking for a way that will enable me to fetch values based on one additional criteria ie if column A or Range("A:A") to contains text "NEW"


    Sheet1.Select
    Chk = Application.Match(rec2, Range("B:B"), 0)
    If Not IsError(Chk) Then
        For i = 2 To 13
            Me.Controls("rec" & i) = Cells(Chk, i)
        Next i
    End If
    Basically two criteria
    !."NEW
    2. rec2.value


    Thanks for reading

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,279

    Re: Return Value to Textboxes based on 2 criterias

    Attach a sample data file - maximum of several dozen lines of data, no more.
    The data should be anonymized to maintain the confidentiality of real data.

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,964

    Re: Return Value to Textboxes based on 2 criterias

        If Not IsError(Chk) Then
            If Cells(Chk, "A").Value = "NEW" Then
                For i = 2 To 13
                    Me.Controls("rec" & i) = Cells(Chk, i).Value
                Next i
            End If
        End If
    Ben Van Johnson

  4. #4
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Return Value to Textboxes based on 2 criterias

    @ protonLeah
    What happens if The first found - as per match - rec2 does not have "NEW" in Col A but "OLD" or something else...

    This should work...No sample file so untested...
    With Sheet1.Cells(1).CurrentRegion
        Chk = Evaluate("=Match(""NEW"" & """ & rec2 & """," & .Columns(1).Address & "&" & .Columns(2).Address & ",0)")
        If Not IsError(Chk) Then
            For i = 2 To 13
                Me.Controls("rec" & i) = Cells(Chk, i)
            Next i
        End If
    End With
    Last edited by Sintek; 09-08-2024 at 07:13 AM.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  5. #5
    Forum Contributor
    Join Date
    10-10-2012
    Location
    Mumbai,India
    MS-Off Ver
    Microsoft Excel 2007
    Posts
    156

    Re: Return Value to Textboxes based on 2 criterias

    @sintek sir !
    Tried your method and it worked Thankyou so much ; uploading a sample file
    @protonleah @mjr veverka Thankyou to you guys for your time !
    Attached Files Attached Files

  6. #6
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Return Value to Textboxes based on 2 criterias

    @sintek sir !
    Tried your method and it worked
    Glad you got it sorted...

+ 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. Return based on a set criterias
    By caamfin in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-21-2021, 12:34 PM
  2. [SOLVED] Return the value of cell based from 2 criterias
    By corinereyes in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 11-25-2020, 04:03 PM
  3. [SOLVED] Return value based on multiple criterias?
    By Busk in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-08-2019, 05:12 AM
  4. [SOLVED] how to return cell value based on criterias
    By MyStix01 in forum Excel General
    Replies: 5
    Last Post: 11-26-2018, 07:33 PM
  5. Return value from sheet to textboxes based on value on another textbox
    By impresxy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-04-2017, 08:55 AM
  6. Return 1st value of duplicates based on multiple criterias
    By Dahlia in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-31-2015, 04:09 AM
  7. [SOLVED] Return MAX date based on two criterias
    By cedequ in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-04-2013, 05:11 AM

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