+ Reply to Thread
Results 1 to 2 of 2

Re: If value match of textboxes then overwrite the value of column(N)

Hybrid View

  1. #1
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,095

    Re: If value match of textboxes then overwrite the value of column(N)

    hi,
    i am sending data to my sheets using textboxes

    for example

    if textbox1, textbox2, textbox3 and textbox4 value match with sheets value then overwrite the data of textbox5

    textbox1.value = "N"
    textbox2.value = "MASTER"
    textbox3.value = "PB"
    textbox4.value = "FBC"

    and textbox5.value = 151 then change only value of Column(n) = 151 instead of 150(this value were before in column(n)

    1.JPG
    thank you
    Attached Files Attached Files
    Last edited by HaroonSid; 06-08-2017 at 06:56 AM.
    Use Code-Tags for showing your code :
    Please mark your question Solved if there has been offered a solution that works fine for you
    If You like solutions provided by anyone, feel free to add reputation using STAR *

  2. #2
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,095

    Re: If value match of textboxes then overwrite textbox value

    This is my original code to send data sheet

    Private Sub CommandButton1_Click()
    If RATE.TextBox5.Value = "" Then Exit Sub
    With Application
            .EnableEvents = False
            .Calculation = xlCalculationManual
            .ScreenUpdating = False
        
    End With
    Dim UserForm As Object
    Dim emptyRow As Long
    Dim ws As Worksheet
    Set ws = Worksheets("RATE")
    emptyRow = Application.WorksheetFunction.CountA(Range("J:J")) + 1
    ws.Cells(emptyRow, 10).Value = Me.TextBox1.Value
    ws.Cells(emptyRow, 11).Value = Me.TextBox2.Value
    ws.Cells(emptyRow, 12).Value = Me.TextBox3.Value
    ws.Cells(emptyRow, 13).Value = Me.TextBox4.Value
    ws.Cells(emptyRow, 14).Value = Me.TextBox5.Value
    With Application
            .EnableEvents = True
            .Calculation = xlCalculationAutomatic
            .ScreenUpdating = True
    End With
    ComboBox2.SetFocus
    End Sub
    and change this one to avoid duplicate entry, i apply this only textbox2 and its working ok, now i also want to apply this code to textbox1, textbox2, textbox3 and textbox4

    If IsError(Application.Match(TextBox2.Text, Worksheets("RATE").Range("k2:k" & Worksheets("RATE").Cells(Rows.Count, "k").End(xlUp).Row), 0)) Then
    Private Sub CommandButton1_Click()
    If RATE.TextBox5.Value = "" Then Exit Sub
    With Application
            .EnableEvents = False
            .Calculation = xlCalculationManual
            .ScreenUpdating = False
        
    End With
    Dim UserForm As Object
    Dim emptyRow As Long
    Dim ws As Worksheet
    Set ws = Worksheets("RATE")
    
    emptyRow = Application.WorksheetFunction.CountA(Range("J:J")) + 1
    If IsError(Application.Match(TextBox2.Text, Worksheets("RATE").Range("k2:k" & Worksheets("RATE").Cells(Rows.Count, "k").End(xlUp).Row), 0)) Then
    ws.Cells(emptyRow, 10).Value = Me.TextBox1.Value
    ws.Cells(emptyRow, 11).Value = Me.TextBox2.Value
    ws.Cells(emptyRow, 12).Value = Me.TextBox3.Value
    ws.Cells(emptyRow, 13).Value = Me.TextBox4.Value
    ws.Cells(emptyRow, 14).Value = Me.TextBox5.Value
    Else: Exit Sub
    End If
    With Application
            .EnableEvents = True
            .Calculation = xlCalculationAutomatic
            .ScreenUpdating = True
    End With
    ComboBox2.SetFocus
    End Sub
    Last edited by HaroonSid; 06-08-2017 at 06:49 AM.

+ 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] Sum three textboxes %age in one textbox on userform
    By xlhelp7 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-20-2016, 02:44 AM
  2. How to concatenate two or more textboxes in one textbox
    By beto77 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-03-2016, 05:17 PM
  3. [SOLVED] Using TextBoxes to Subtract a constant value from another TextBox
    By Gal403 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-25-2015, 12:43 PM
  4. [SOLVED] Show Error IF TextBox not matched
    By AmirSoft in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-27-2014, 06:41 AM
  5. [SOLVED] URGENCY: Textbox does the union of the other textboxes
    By carapins in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-17-2013, 07:05 AM
  6. [SOLVED] Several Textboxes values into one textbox
    By sagar007 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-17-2012, 08:11 AM
  7. How to update textbox from other textboxes
    By chris0374 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-12-2010, 04:20 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