+ Reply to Thread
Results 1 to 5 of 5

Help to set value from textbox then copy row if condition is meet with that value

  1. #1
    Forum Contributor
    Join Date
    10-29-2017
    Location
    US
    MS-Off Ver
    2013
    Posts
    142

    Help to set value from textbox then copy row if condition is meet with that value

    Hi all

    I have workbook with form to type value, form have 02 textbox.
    If textbox1 = "" then Exit Sub
    This value use to find in column(A) in 02 sheet(array("nb","ngb"))
    If condition is meet with Textbox1 then copy that row to sheet(ky1), if meet with Textbox2 then copy that row to sheet(ky2)

    For examble: Textbox1 I type: "aaaaa001-201908" or only type: "aaaa001" => If column A in sheet(nb), sheet(ngb) are meet then copy that row to sheet(ky1).
    My code below have mistake at line: Type Miss match - error "13"
    ans1 = UserForms(CDKT).TextBox1.Value
    ans2 = UserForms(CDKT).TextBox2.Value

    Please see at my attachment to clear my idea. Thanks./.
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Help to set value from textbox then copy row if condition is meet with that value

    You are closing the userform before the code knows what to look for.

    the one code should just show the userform

    Please Login or Register  to view this content.
    You can have the userform command button do the filtering.
    -
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    10-29-2017
    Location
    US
    MS-Off Ver
    2013
    Posts
    142

    Re: Help to set value from textbox then copy row if condition is meet with that value

    Great solution @davesexcel, code work well.

    May I have another question?
    I want to check that: If ans1 = "" then exit Sub

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Help to set value from textbox then copy row if condition is meet with that value

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    10-29-2017
    Location
    US
    MS-Off Ver
    2013
    Posts
    142

    Re: Help to set value from textbox then copy row if condition is meet with that value

    Thanks for your kind @davesexcel

+ 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. [SOLVED] Getting an garbage value - If condition is not meet.
    By Shahbazk in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-20-2018, 03:24 AM
  2. [SOLVED] Color a cell If 2 other cells meet condition, undo cell color if third cell meet condition
    By aftbrah in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-28-2016, 01:17 AM
  3. how to copy data from the textbox if condition is true or false???
    By clinton96 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-03-2016, 03:03 AM
  4. meet condition
    By dklem in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 11-30-2015, 06:11 AM
  5. [SOLVED] Userform Label visible if two textbox values meet condition
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-20-2014, 01:57 AM
  6. Replies: 1
    Last Post: 05-11-2013, 02:58 AM
  7. MIN of only cells that meet condition
    By jbc242 in forum Excel General
    Replies: 4
    Last Post: 06-27-2011, 12:18 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