+ Reply to Thread
Results 1 to 2 of 2

How can I overwrite cells

  1. #1
    Registered User
    Join Date
    04-18-2007
    Posts
    3

    How can I overwrite cells

    Hi guys!

    I am facing a problem:

    I am using a userform to get data into a spreadsheet.

    Now there is a possibility that data which is already in the sheet has to be updated.

    Therefore, I use the change procedur that loads the information back into my userform.

    But now I am stuck!!
    I cant get the new information replacing the old.

    Does anyone know how to do this?

    Here is the code that I use right now.

    Private Sub textbox1_change()
    Dim IntY As Integer
    IntY = 2
    With ThisWorkbook.Worksheets("Tabelle1")
    Do Until .Cells(IntY, 1) = ""
    If Val(TextBox1) = Cells(IntY, 1) Then
    TextBox2 = .Cells(IntY, 2)
    TextBox3 = .Cells(IntY, 3)
    TextBox4 = .Cells(IntY, 4)

    Exit Do
    End If
    IntY = IntY + 1
    Loop
    If .Cells(IntY, 2) = "" Then
    TextBox2 = ""
    TextBox3 = ""
    TextBox4 = ""
    TextBox5 = ""
    End If
    End With
    End Sub

    AND


    private sub cmd_Click
    dim inty as integer

    with thisworkbook.worksheets("Tabelle1")
    inty = 2
    do until .cells(inty, 1) = ""
    inty = inty +1
    loop

    .cells(inty, 1) = txtID
    .cells(inty, 2)= txtLast
    .cells(inty, 3) = txtFirst
    .cells(inty, 4) = txtAge
    end with
    end sub

    Help is greatly appreciated!!!!

    Tnx Christian

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    Try with this code:

    Please Login or Register  to view this content.
    I hope it's what you need.

    Regards,
    Antonio

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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