Results 1 to 3 of 3

VBA: copy row from one sheet to another using a specific cell as reference

Threaded View

  1. #1
    Registered User
    Join Date
    01-08-2018
    Location
    Malaysia
    MS-Off Ver
    MS office 2013
    Posts
    1

    VBA: copy row from one sheet to another using a specific cell as reference

    Hi everyone,

    I am having a problem with my formula below. I am trying to pull out specific rows based on cell reference "B7" in the "Documentation" sheet from the "control matrix' sheet:


    Sub MoveRowBasedOnCellValue()
    
        Dim xRg As Range
        Dim xCell As Range
        Dim I As Long
        Dim J As Long
        Dim K As Long
        I = Worksheets("Control matrix").UsedRange.Rows.Count
        J = Worksheets("Documentation").UsedRange.Rows.Count
        If J = 1 Then
        If Application.WorksheetFunction.CountA(Worksheets("Documentation").UsedRange) = 0 Then J = 0
        End If
        Set xRg = Worksheets("Control matrix").Range("A1:S203" & I)
        On Error Resume Next
        Application.ScreenUpdating = False
        For K = 1 To xRg.Count
            If CStr(xRg(A).Value) = "B7" Then
                xRg(K).EntireRow.Copy Destination:=Worksheets("Documentation").Range("A19" & J + 1)
                J = J + 1
            End If
        Next
    Brief description of data acronyms:
    Control matrix: Is the sheet where the table is in. I want to pull specific rows from this sheet into the Documentation sheet using the cell reference B7
    Documentation: Is the destination path of the rows selected based on cell reference B7.
    A1:S203: Is the excel reference of the table under the control matrix sheet
    B7: Is the cell reference that consist the details that i want to pull out. This cell reference corresponds the details located in column A in the control matrix sheet
    A19: Is the cell that represents the destination where i want the rows to populate into.

    I am really new to this and appreciate all the help I can get to get my formula working. I have attached the workbook as reference.

    Thanks everyone!!

    Regards,

    Shankar
    Attached Files Attached Files
    Last edited by vimalashankar; 01-09-2018 at 03:31 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 specific cell value on sheet1 to specific cell on sheet2 or other sheet.
    By Mr.GfCs in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-20-2015, 02:41 PM
  2. Replies: 2
    Last Post: 11-18-2013, 07:31 AM
  3. [SOLVED] Copy specific cells from 1 sheet to another, conditional upon entering a unique reference.
    By Terri H in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-09-2013, 05:39 AM
  4. Replies: 2
    Last Post: 07-24-2012, 05:58 PM
  5. Copy & paste specific column based on cell reference
    By ccsmith in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-26-2011, 03:59 AM
  6. Search sheet for specific cell and obtain reference
    By sonikin in forum Excel General
    Replies: 5
    Last Post: 05-22-2011, 08:03 PM
  7. Copy specific columns to specific cell on new sheet
    By jones_net in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-19-2010, 02:34 AM

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