title: Excel VBA or not to VBA, replace text if different between two cells
body: <p>I have a quandary, and I don't know if it will work better using excel VBA or not. Thinking about it I believe VBA will work best, but I don't know how to make it work. </p>
  
  <p>I have two pages in a workbook, one is the form, the other is the database, I want the pulldown menu from the form to populate the rest of the form. It does... what I want then is to be able to change the value of the form press submit, and the new data will overwrite the old data.</p>
  
  <p>Is this possible?</p>
  
  <p>Here is the link to the sheet I'm talking about. </p>
  
  <p><a href="http://dl.dropbox.com/u/3327208/Excel/Change.xlsx" rel="nofollow">http://dl.dropbox.com/u/3327208/Excel/Change.xlsx</a></p>
  
  <p>Here is the script I am working with now...it takes the sheet, copies everything to a row takes that row, moves it to the NCMR Data tab and then clears the data on the new row from the original sheet.</p>
  
  <p>This code technically could work, but what I need to do is make it use the same concept, but instead of creating a new row at the end of the sheet find the original line and replace the data from B to U in whatever row it was originally in.</p>
  
  <p>I know it's possible, I just don't know how.</p>
  
  <pre><code> 'Copy Ranges Variable
      Dim c As Variant
  
      'Paste Ranges Variable
      Dim p As Range
  
      'Setting Sheet
      Set wsInt = Sheets("Form")
      Set wsNDA = Sheets("Data")
      Set p = wsInt.Range("A14")
  
      With wsInt
          c = Array(.Range("B11"))
      End With
  
      For i = LBound(c) To UBound(c)
          p(i + 1).Value = c(i).Value
      Next
  
      With wsNDA
          Dim Lastrow As Long
  
          Lastrow = .Range("B" &amp; Rows.Count).End(xlUp).Row + 1
  
          wsInt.Rows("14").Copy
  
          With .Rows(Lastrow)
              .PasteSpecial Paste:=xlPasteFormats
              .PasteSpecial Paste:=xlPasteValues
              .Interior.Pattern = xlNone
          End With
  
          With .Range("A" &amp; Lastrow)
              If Lastrow = 3 Then
                  .Value = 1
              Else
                  .Value = Val(wsNDA.Range("A" &amp; Lastrow - 1).Value) + 1
              End If
  
              .NumberFormat = "0#######"
          End With
      End With
  End Sub
  </code></pre>
  
  <p>I found this code: </p>
  
  <pre><code>Sub CopyTest()
  Dim selrow As Range, rngToCopy As Range
  
  With Worksheets("PD DB")
      Set selrow = .Range("B:B").Find(.Range("BA1").Value)
      'find the cell containing the value
      Set rngToCopy = Union(selrow.Offset(0, 9), selrow.Offset(0, 12))
      'use offset to define the ranges to be copied
      rngToCopy.Copy Destination:=Worksheets("Edit Sheet").Range("B50")
      'copy and paste (without Select)
  End With
  
  End Sub
  </code></pre>
  
  <p>As far as I can tell this will do what I want mostly, but I can't seem to figure out where to break it up to add it where I need to to make it work the way I want it to.</p>
  
  <p>What I can tell is this, it will copy and paste, but I want to make sure it will paste the data into row it finds, and not overwrite the number of said row. </p>
  
  <p>Can someone help make that possible with the two scripts I have here?</p>