Results 1 to 6 of 6

find value, copy&paste range to fill database

Threaded View

  1. #1
    Forum Contributor
    Join Date
    04-21-2010
    Location
    Budapest
    MS-Off Ver
    Excel 2010
    Posts
    155

    find value, copy&paste range to fill database

    Hi,

    I would need your help to create a macro for the following task.
    In the attachment yuo can find sample workbook.
    From sheet ("Main") I have values in cells B2:E2. I have to find the value of B2 in worksheet ("DB") and copy C2 and E2 to the related rows (column B and C) in ("db").
    I tried the following without success:

    Sub FindandCopy()
    
    Dim ID As String
    
    
    ID = Worksheets("MAIN").Range("B2").Value
    
    For i = 1 To Worksheets("DB").Cells(Rows.Count, 1).End(xlUp).Row
    
       If Worksheets("DB").Cells(i, 1).Value = ID Then
       Worksheets("MAIN").Range("C2").Copy
       Destination = Worksheets("MAIN").Cells(i, 2)
       Worksheets("MAIN").Range("E2").Copy
       Destination = Worksheets("MAIN").Cells(i, 3)
    
      End If
    
    Next i
    
    End Sub
    Attached Files Attached Files
    Last edited by ccsmith; 12-05-2016 at 11:26 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Copy range after find date paste value
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2015, 12:46 PM
  2. [SOLVED] Find Text - Copy Range Below - Paste to Cell
    By keen2xl in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-02-2014, 05:39 AM
  3. how to copy a range of cells, paste them and then find next empty cell
    By comp23 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2013, 03:34 PM
  4. copy cell range as bitmap and paste into document within a database in lotus notes
    By exceliscool in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-29-2013, 06:10 PM
  5. [SOLVED] Macro to Find, copy, paste, find, copy, paste, find, copy, paste, u get the picture....
    By westsoldman in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-12-2012, 01:12 AM
  6. VBA macro to Find a dynamic range of cells, copy then paste to another sheet
    By Bmxerdude2087 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-24-2012, 02:36 PM
  7. Find Text, Select range below, copy, paste to new work sheet
    By kim5012 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-13-2011, 07:10 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