+ Reply to Thread
Results 1 to 7 of 7

Find Value of First sheet in another and copy related data for that cell value and paste.

  1. #1
    Registered User
    Join Date
    11-30-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    31

    Find Value of First sheet in another and copy related data for that cell value and paste.

    Hi All,

    I want to Find a cell value of my First sheet (Column A Values) i.e. named as master sheet in another sheet i.e. in statement sheet

    If match found then copy related data for that cell value in Master sheet columns.

    see attached sheet for more information

    i have tried to do it and it is doing for my first criteria (i.e. Opening Balance) but i can't copy other criteria's for the same cell value

    Sub test()
    Dim FindString As String
    Dim Rng As Range
    Dim lastrow As Long
    lastrow = Sheets("master").Cells(Rows.Count, "A").End(xlUp).Row
    Dim i As Long
    Sheets("master").Activate
    Range("A2").Activate
    For i = 1 To lastrow
    FindString = ActiveCell.Value
    If Trim(FindString) <> "" Then
    With Sheets("statement").Range("A:A")
    Set Rng = .Find(What:=FindString, _
    after:=.Cells(.Cells.Count), _
    LookIn:=xlValues, _
    LookAt:=xlWhole, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, _
    MatchCase:=False)
    If Not Rng Is Nothing Then
    Rng.Offset(1, 1).Copy
    Sheets("master").Activate
    ActiveCell.Offset(0, 2).PasteSpecial
    ActiveCell.Offset(1, -2).Activate
    Else
    ActiveCell.Offset(1, 0).Activate
    End If
    End With
    End If
    Next i
    End Sub


    or sugessest me if there is any another way to do it....!, your help i much appreciated...! waiting for reply...!!!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find Value of First sheet in another and copy related data for that cell value and pas

    Deepak,
    Please use code tags with your code as per forum's rule.
    The code works by matching the headings in master sheet ,row 1, with the headings in the statement sheet.
    I have to change some of the names of the headings in master sheet as so to match them with statement sheet.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    11-30-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Find Value of First sheet in another and copy related data for that cell value and pas

    Hi Thanks for reply....., but i am a beginner for Vba- Macro so, i am not able to understand the code provided by you
    and if i want to add My Criteria Tab adjucent to Opening Balance and others then what can i do....

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find Value of First sheet in another and copy related data for that cell value and pas

    Does the code work for you and if not what is the issue?
    Attach a desired result.

  5. #5
    Registered User
    Join Date
    11-30-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Find Value of First sheet in another and copy related data for that cell value and pas

    Hi AB33,

    Yes your code is working perfiectly, but i am just wondoring to add some criteria later on my Master sheet which will be on Statement sheet.

    I have updated the New criteria's on example sheet. and please suggest me where should i add new code line or where should i change it (If necessary).

    Thanks..!
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find Value of First sheet in another and copy related data for that cell value and pas

    This should work with any column size so long as the headings match.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-30-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Find Value of First sheet in another and copy related data for that cell value and pas

    It's Working perfectly, Thanks AB33...!

+ 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] Find value in a cell in different sheets and copy and paste other cells to another sheet
    By the-hawk in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-04-2013, 03:36 AM
  2. [SOLVED] Copy, paste cells related to another cell; concatenate if possible
    By bob33 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-29-2013, 12:22 PM
  3. [SOLVED] find value, copy value of adjacent cell and paste it on another sheet
    By Ajgor in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2012, 04:21 PM
  4. Find Adjacent Data In One Sheet and Copy/Paste Into Other Sheet
    By jaylotheman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2011, 07:19 PM
  5. Find value from sheet 1, cell A1 in sheet(s) 2 (3, 4?), copy, paste row to sheet 8
    By fleeting in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2011, 03:31 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