+ Reply to Thread
Results 1 to 3 of 3

Thread: Office project:DATABASE DATA COPY FROM ONE TO ANOTHER

  1. #1
    Registered User
    Join Date
    08-15-2011
    Location
    Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    38

    Office project:DATABASE DATA COPY FROM ONE TO ANOTHER

    My code is currently copying the training dates under the specified names i want it to copy the rest of the three columns as well the code is


    Sub finds(strName As String)
    '
    ' finds Macro
       Dim wksHSE            As Excel.Worksheet
       Dim wksEmp            As Excel.Worksheet
       Dim varColumn
    
       Set wksEmp = Sheets("Emp Ind HSE")
       Set wksHSE = Sheets("HSE_Matrix")
    
       ' find employee column on matrix sheet
       varColumn = Application.Match(strName, wksHSE.Range("7:7"), 0)
       If IsError(varColumn) Then
          ' no match so display error message
          MsgBox "No match found for employee: " & strName
       Else
          ' copy employee data across
          wksHSE.Cells(9, varColumn).Resize(43, 1).Copy Destination:=wksEmp.Range("H8:H50")
          wksEmp.Range("c5").Value = wksHSE.Cells(53, varColumn).Value
       End If
    
    End Sub
    Is there a way where i can also store the columns adjacent to the varColumn like varColumn1 varColumn2 to cover all the 4 columns under the name
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    06-19-2010
    Location
    Holywell, N Wales, UK
    MS-Off Ver
    Excel 2007
    Posts
    351

    Re: Office project:DATABASE DATA COPY FROM ONE TO ANOTHER

    hattisaeed
    This is a duplicate of your earlier post (of just one hour previously) and to which I have already replied with a possible solution.
    Please read forum rules 5 and 8 and appreciate the need for not confusing those who are prepared and happy to spend time helping.
    Patience is a virtue expecially (in my case anyway) across international time zones.
    That said, I hope that you find a solution to your problem.
    Barry

  3. #3
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,640

    Re: Office project:DATABASE DATA COPY FROM ONE TO ANOTHER

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

+ 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