move visible data to another sheet based on a value in a column

mikeonwow

New Member
Joined
Nov 13, 2017
Messages
10
I would like to thank all in advance for any help/guidance they can provide.

I have searched through a good portion of the post on this subject and I am not finding what I need or enough to take what I have and adjust it.

GOAL: Scan through the filtered table and copy rows that have not been printed onto another sheet to be used for a mail merge process. I need to copy specific columns in a specific order and I only want to move values, no formatting or calculations.

Once the values have been copied I want to mark a column in the original sheet to show the data has been moved along with another column updated with a timestamp.

The example below almost accomplishes what I want and it works in a fashion. It does not mark the column "U" is the signified as printed column and it does not yet put a timestamp in column V that signifies when it was printed.

Code:
[I]Sub [/I][I]Almostworks[/I][I]()[/I]
[I]    Application.ScreenUpdating = False[/I]
[I]    Application.Calculation = xlCalculationManual[/I]

[I]    Dim path As String, [/I][I]fileName[/I][I] As String[/I]
[I]    Dim lastRowInput As Long[/I]
[I]    Dim lastRowOutput As Long[/I]
[I]    Dim rowCntr As Long[/I]
[I]    Dim lastColumn As Long[/I]
[I]    Dim [/I][I]inputWS[/I][I] As Worksheet[/I]
[I]    Dim [/I][I]outputWS[/I][I] As Worksheet[/I]

[I]    'set your sheets here[/I]
[I]    Set inputWS = ThisWorkbook.Sheets("DevTrack")[/I]
[I]    Set outputWS = ThisWorkbook.Sheets("MergPrep")[/I]
[I]    rowCntr = 1[/I]

[I]    'get last rows from both sheets[/I]
[I]    lastRowInput = inputWS.Cells(Rows.Count, "B").End(xlUp).Row[/I]
[I]    lastRowOutput = outputWS.Cells(Rows.Count, "B").End(xlUp).Row[/I]
[I]    lastColumn = inputWS.Cells(1, Columns.Count).End(xlToLeft).Column[/I]

[I]    'copy data from development tracker sheet to merge prep sheet[/I]
[I]'Track[/I]
[I]    inputWS.Range("I9:I" & lastRowInput).Copy outputWS.Range("A" & lastRowOutput + 1)[/I]
[I]'PMCID[/I]
[I]    inputWS.Range("B9:B" & lastRowInput).Copy outputWS.Range("B" & lastRowOutput + 1)[/I]
[I]'Change type[/I]
[I]    inputWS.Range("G9:G" & lastRowInput).Copy outputWS.Range("C" & lastRowOutput + 1)[/I]
[I]'Description[/I]
[I]    inputWS.Range("C9:C" & lastRowInput).Copy outputWS.Range("D" & lastRowOutput + 1)[/I]
[I]'RICEWID[/I]
[I]    inputWS.Range("E9:E" & lastRowInput).Copy outputWS.Range("E" & lastRowOutput + 1)[/I]
[I]'MD50 Author[/I]
[I]    inputWS.Range("N9:N" & lastRowInput).Copy outputWS.Range("F" & lastRowOutput + 1)[/I]
[I]'MD50 Owner[/I]
[I]    inputWS.Range("N9:N" & lastRowInput).Copy outputWS.Range("G" & lastRowOutput + 1)[/I]
[I]'MD50 Target Date[/I]
[I]    inputWS.Range("O9:O" & lastRowInput).Copy outputWS.Range("H" & lastRowOutput + 1)[/I]
[I]'MD70 Author[/I]
[I]    inputWS.Range("V9:V" & lastRowInput).Copy outputWS.Range("I" & lastRowOutput + 1)[/I]
[I]'MD70 Owner[/I]
[I]    inputWS.Range("V9:V" & lastRowInput).Copy outputWS.Range("J" & lastRowOutput + 1)[/I]
[I]'MD70 Target Date[/I]
[I]    inputWS.Range("X9:X" & lastRowInput).Copy outputWS.Range("K" & lastRowOutput + 1)[/I]
[I]'BR100 Author[/I]
[I]    inputWS.Range("N9:N" & lastRowInput).Copy outputWS.Range("L" & lastRowOutput + 1)[/I]
[I]'BR100 Owner[/I]
[I]    inputWS.Range("N9:N" & lastRowInput).Copy outputWS.Range("M" & lastRowOutput + 1)[/I]
[I]'BR100 Target Date[/I]
[I]    inputWS.Range("O9:O" & lastRowInput).Copy outputWS.Range("N" & lastRowOutput + 1)[/I]
[I]'FOT Author[/I]
[I]    inputWS.Range("V9:V" & lastRowInput).Copy outputWS.Range("O" & lastRowOutput + 1)[/I]
[I]'FOT Owner[/I]
[I]    inputWS.Range("V9:V" & lastRowInput).Copy outputWS.Range("P" & lastRowOutput + 1)[/I]
[I]'FOT Target Date[/I]
[I]    inputWS.Range("X9:X" & lastRowInput).Copy outputWS.Range("Q" & lastRowOutput + 1)[/I]
[I]'Target Release[/I]
[I]    inputWS.Range("K9:K" & lastRowInput).Copy outputWS.Range("R" & lastRowOutput + 1)[/I]
[I]'Copy Count[/I]
[I]    inputWS.Range("ZZ9:ZZ" & lastRowInput).Copy outputWS.Range("S" & lastRowOutput + 1)[/I]
[I]'Change Owner[/I]
[I]    inputWS.Range("I9:I" & lastRowInput).Copy outputWS.Range("T" & lastRowOutput + 1)[/I]

[I]    Application.ScreenUpdating = True[/I]
[I]    Application.Calculation = xlCalculationAutomatic[/I]
[I]End Sub

[/I]
 
Last edited by a moderator:

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Code:
inputWS.Range("U9:U" & lastRowInput).SpecialCells(xlCellTypeVisible).Value = "Printed"
inputWS.Range("V9:V" & lastRowInput).SpecialCells(xlCellTypeVisible).Value = Now
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,081
Members
453,021
Latest member
Justyna P

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