How to Transfer Specific Data from One Sheet to another through VBA in Excel?
Tags: totransferspecificda, vbamacros
Published: 2021-10-01 05:26:37

---
title: How to Transfer Specific Data from One Sheet to another through VBA in Excel?
published: true
date: 2021-09-30 08:03:07 UTC
tags: ToTransferSpecificDa,VBAMacros
canonical_url: https://geekexcel.com/how-to-transfer-specific-data-from-one-sheet-to-another-through-vba-in-excel/
---

In this blog post, we are going to see how to  **transfer specific data from one sheet to another** through VBA in Microsoft Excel. Let’s get into this article!! Get an official version of MS Excel from the following link: **[https://www.microsoft.com/en-in/microsoft-365/excel](https://www.microsoft.com/en-in/microsoft-365/excel)**

## Example

- Firstly, you need to **create a sample data** with **customer details, which includes Name, Street Address, City, Region, Country and Phone number**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Sample-data-48-1024x566.png)<figcaption>Sample data</figcaption>

- In the Excel Worksheet, you have to go to the  **Developer Tab.**
- Then, you need to ** ** select the  **Visual Basic**  option under the  **Code**  section.

![Select Visual Basic](https://geekexcel.com/wp-content/uploads/2021/09/Select-Visual-Basic-9-1024x180.png)<figcaption>Select Visual Basic</figcaption>

- Now, you have to  **copy and paste the code**  given below.

```
Private Sub Worksheet_Change(ByVal Target As Range)

'Declaring variables
Dim i, Lastrow As Long

'Execute code if value in seventh column is changed
If Target.Column = 7 Then

    'Getting the row number of last cell
    Lastrow = Sheets("Main").Range("A" & Rows.Count).End(xlUp).Row
    
    'Deleting any previous data from "NotEligibleData" sheet
    Sheets("NotEligibleData").Range("A2:I600").ClearContents
    
    'Looping from tenth row to last row
    For i = 10 To Lastrow
        
        'If value in G column of the row is "Not" then copy the row to destination sheet
        If Sheets("Main").Cells(i, "G").Value = "Not" Then
            Sheets("Main").Cells(i, "G").EntireRow.Copy Destination:=Sheets("NotEligibleData").Range("A" & Rows.Count).End(xlUp).Offset(1)
        End If
    Next i
End If

Range("A1").Select

End Sub

```

- You need to  **save the code**  by selecting it and then  **close the window**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Save-the-Code-99-1024x432.png)<figcaption>Save the Code</figcaption>

- Again, you have to go to the  **Excel Spreadsheet** , and click on the  **Developer Tab**.
- Then, you need to choose the  **Macros option**  in the Code section.

![Choose Macro option](https://geekexcel.com/wp-content/uploads/2021/09/Choose-Macro-option-11-1024x184.png)<figcaption>Choose Macro option</figcaption>

- Now, you have to make sure that your  **macro name is selected**  and click the  **Run ** button.
- After that, the last column returns **“Not” as value** , if a customer is **not eligible for a**  **particular offer**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Not-eligible-values-1024x386.png)<figcaption>Not eligible for a particular offer</figcaption>

- Finally, you need to copy those **“not eligible” customers to “NotEligibleData” sheet**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Output-46.png)<figcaption>Output</figcaption>

## Verdict

In the above article, you can learn the simple steps on how to ** transfer specific data from one sheet to another** through VBA in Microsoft Excel. Kindly, share your **feedback** in the below comment section. Thanks for visiting **[Geek Excel.](https://geekexcel.com/)** Keep Learning!

**Read Also:**

- **[How to Change Font Color in Microsoft Excel 2007?](https://geekexcel.com/how-to-change-font-color-in-microsoft-excel-2007/)**
- **[Excel Formulas to Count specific word in a range ~ Easy Tutorial!!](https://geekexcel.com/excel-formulas-to-count-specific-words-in-a-range/)**
- **[Excel Formulas to Get the Last Word of a Text String ~ Quick Method!!](https://geekexcel.com/excel-formulas-to-get-the-last-word-of-the-text-string/)**
- **[Count the Times a Word Appears in a Cell or a Range in Excel Office 365!!](https://geekexcel.com/count-the-times-a-word-appears-in-a-cell-or-a-range-in-excel-office-365/)**
- **[Excel Formulas to Remove the Last Word ~ Easy Tutorial!!](https://geekexcel.com/excel-formulas-to-remove-the-last-word-easy-tutorial/)**