+ Reply to Thread
Results 1 to 3 of 3

Thread: search/manually modify and update record

  1. #1
    Registered User
    Join Date
    06-25-2008
    Posts
    39

    search/manually modify and update record

    anyone ???
    Attached Files Attached Files
    Last edited by belkin; 07-07-2011 at 03:13 AM.

  2. #2
    Registered User
    Join Date
    06-25-2008
    Posts
    39

    search and replace row in worksheet

    Hello

    I wish to create a macro to search a sheet called "data" for a number in column a only. Once it has found that number, copy and paste special and transpose in a worksheet called "user page" in cell "b2" say, Then i want to be able to modify the info just pasted and then use a second macro to take the modified info and replace back in the "data" where it came from in the same row ideally. i am currently doing it using a valadation list for my number and a macro to filter the row i want copying and pasting in a new weeksheet then copying again, but the marco is slow and i am looking to have the vba run faster but i do not quite have the skiils to manage it. Any help would be appreciated.
    example work book attached 2003!
    Belkin
    Attached Files Attached Files
    Last edited by belkin; 07-07-2011 at 03:44 AM.

  3. #3
    Forum Guru
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2003
    Posts
    1,241

    Re: search/manually modify and update record

    In attached file, when you type something in range A2 it will retrieve data from second sheet. Then modify data and click on update command.
    I used these macros:
    Private Sub Worksheet_Change(ByVal Target As Range)
       Dim mySh As Worksheet, found As Range
       
       If Target.Address(0, 0) = "A2" Then
          'find data
          Set mySh = ThisWorkbook.Sheets(2)
          Set found = mySh.Range("a:a").Find(Target.Value, LookAt:=xlWhole)
          If Not found Is Nothing Then
             'copy 100 columns, A-CV
             found.Resize(1, 100).Copy Target.Offset(, 1)
          End If
       End If
    End Sub
    
    Sub Update()
       Dim mySh1 As Worksheet, mySh2 As Worksheet, found As Range
       
       Set mySh1 = ThisWorkbook.ActiveSheet
       Set mySh2 = ThisWorkbook.Sheets(2)
       Set found = mySh2.Range("a:a").Find(mySh1.Range("a2").Value, LookAt:=xlWhole)
       If Not found Is Nothing Then
          mySh1.Range("b2").Resize(1, 100).Copy found
       End If
    End Sub
    Regards,
    Antonio
    Attached Files Attached Files

+ 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.2.0