Results 1 to 8 of 8

Userform - Adding Data to Existing Rows

Threaded View

Mousiefuzz Userform - Adding Data to... 04-29-2015, 07:09 AM
davesexcel Re: Userform - Adding Data to... 04-29-2015, 07:30 AM
Mousiefuzz Re: Userform - Adding Data to... 04-29-2015, 07:40 AM
Mousiefuzz Re: Userform - Adding Data to... 04-30-2015, 04:10 AM
zbor Re: Userform - Adding Data to... 04-30-2015, 08:13 AM
TMS Re: Userform - Adding Data to... 04-30-2015, 08:27 AM
Mousiefuzz Re: Userform - Adding Data to... 04-30-2015, 09:01 AM
TMS Re: Userform - Adding Data to... 04-30-2015, 09:40 AM
  1. #1
    Registered User
    Join Date
    04-29-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    33

    Userform - Adding Data to Existing Rows

    What I currently have working (it's a working progress still to be tweaked) is a Userform for inputting data into relevant rows (inputform).
    What I now need and have almost got working is another Userform for adding in some additional information and preferably overwriting any existing data (updateform).

    I'm very new to VBA and have been doing my best to get my head around it but can't say I completely understand all the terms, I work with taking existing code I have found elsewhere and editing it to best suit my needs. This means a lot of fiddling to try see exactly what each line of code is doing. With my current task I've about reached my limit and am now well and truly stuck on how to fix this issue. In short, there may be a lot of irrelevant/incorrect lines of code that I haven't realised are irrelevant/incorrect.

    So, to the issue in hand.

    I will have lots of unique contract numbers (column A) that I will be using to bring up the details in the update form.
    I have the client name (column D) which is currently serving as a check to make sure I have brought up the correct contract.
    Then I have 7 more boxes to be filled out with the new data that I want added to existing rows (Columns AG,AM,AN,AO,AU,AV,AW)

    I have a piece of code that I thought should work but it just adds the data to a new row and I can't seem to figure out why it is doing this or how to get it to instead write in the existing rows. (Update Button)

    Private Sub cmbUpdate_Click()
    Dim contract As String, client As String, setup As String, captm As String, inttm As String, arrtm As String, misspa As String, retpf As String, dpic As String
    contract = txtContractNumber.Text
    Cells(currentrow, 1).Value = contract
    client = txtClient.Text
    Cells(currentrow, 4).Value = client
    setup = cbxSetUpFeePaid.Text
    Cells(currentrow, 33).Value = setup
    captm = txtCapitalThisMonth.Text
    Cells(currentrow, 39).Value = captm
    inttm = txtInterestThisMonth.Text
    Cells(currentrow, 40).Value = inttm
    arrtm = txtArrearsThisMonth.Text
    Cells(currentrow, 41).Value = arrtm
    misspa = txtMissedPaymentAmount.Text
    Cells(currentrow, 47).Value = misspa
    retpf = txtReturnedPaymentFee.Text
    Cells(currentrow, 48).Value = retpf
    dpic = txtDelayedPaymentInterestCharge.Text
    Cells(currentrow, 49).Value = dpic
    End Sub
    The only thing that I can think of that would be causing this issue (if it's not part of the above code) is the piece of code that brings up the information to begin with. (Find Button)

    Private Sub cmbFind_Click()
    Dim lastrow
    Dim myContractNumber As String
    lastrow = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
    myContractNumber = txtContractNumber.Text
    For currentrow = 2 To lastrow
    If Cells(currentrow, 1).Text = myContractNumber Then
    
    txtContractNumber.Text = Cells(currentrow, 1).Text
    txtClient.Text = Cells(currentrow, 4).Text
    
    End If
    Next currentrow
    txtContractNumber.SetFocus
    End Sub
    Please let me know if I've missed out any relevant data!
    Attached Files Attached Files
    Last edited by Mousiefuzz; 04-30-2015 at 04:09 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Adding two rows after every existing row
    By Hitch75 in forum Excel General
    Replies: 11
    Last Post: 10-15-2014, 03:07 AM
  2. Need help with USERFORM adding extra data to an existing list
    By fur in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-13-2014, 08:25 AM
  3. [SOLVED] Adding new sheet to existing userform
    By darkangl640 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-25-2013, 12:49 PM
  4. Adding Code to an Existing UserForm with VBA
    By JimmyA in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-08-2010, 12:02 PM
  5. Userform problem adding to existing rows of data
    By glenness in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-20-2007, 09:59 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