VBA macro to copy specific data onto new workbook

ConnollyFLS

New Member
Joined
Jan 7, 2020
Messages
3
Office Version
  1. 2013
Platform
  1. Windows
Hi All,

Firstly, apologies for my lack of knowledge - VBA is new to me as of today.

The situation I have is as follows:

My company has a "Master Sheet", This sheet contains ALL booking information for our customers. The problem I have is that we no longer want to simply Hide data on the spreadsheet, What we are aiming to do is set a specific VBA macro to cut and paste a Row from The master sheet to a separate workbook once the job has been processed - Actioned by Typing "Complete" in a certain column on the row.

I hope I have explained this well enough, Any assistance would be greatly appreciated.

Thank you,
Tom
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
The following code places the "Cut" row in a worksheet in the same workbook. The sheet name is "Sheet2"

VBA Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim s2 As Worksheet, lr As Long
    Set s2 = Sheets("Sheet2")
    If Target.Column = 10 Then
        If Target = "Complete" Then
            Target.EntireRow.Copy
            lr = s2.Range("A" & Rows.Count).End(xlUp).Row + 1
            s2.Range("A" & lr).PasteSpecial xlPasteValues
            Target.EntireRow.Delete
        End If
    End If
End Sub

This code is to be placed in the worksheet_change event of the VBE.
The file needs to saved as macro enabled. "xlsm"
 
Upvote 0
The following code places the "Cut" row in a worksheet in the same workbook. The sheet name is "Sheet2"

VBA Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim s2 As Worksheet, lr As Long
    Set s2 = Sheets("Sheet2")
    If Target.Column = 10 Then
        If Target = "Complete" Then
            Target.EntireRow.Copy
            lr = s2.Range("A" & Rows.Count).End(xlUp).Row + 1
            s2.Range("A" & lr).PasteSpecial xlPasteValues
            Target.EntireRow.Delete
        End If
    End If
End Sub

This code is to be placed in the worksheet_change event of the VBE.
The file needs to saved as macro enabled. "xlsm"


Thank you once again for your gem of knowledge, I will try and implement this Tomorrow and will revert back.

Have a good evening Sir
Tom
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top