Hi,
I a spreadsheet ("Sales") that tracks a total sales figure and each day is a new column. e.g. the below table.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]03/06/2018[/TD]
[TD]04/06/2018[/TD]
[TD]05/06/2018[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Sales[/TD]
[TD]50,000[/TD]
[TD]60,000[/TD]
[TD]65,000[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Costs[/TD]
[TD]10,000[/TD]
[TD]32,000[/TD]
[TD]4,000[/TD]
[/TR]
[TR]
[TD]...[/TD]
[TD].....[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]...[/TD]
[TD]....[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]...[/TD]
[TD]...[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]106[/TD]
[TD]Salesperson1[/TD]
[TD]24,000[/TD]
[TD]29,000[/TD]
[TD]36,000[/TD]
[/TR]
[TR]
[TD]107[/TD]
[TD]Salesperson2[/TD]
[TD]18,000[/TD]
[TD]18,500[/TD]
[TD]28,000[/TD]
[/TR]
</tbody>[/TABLE]
I need to find the last values in rows 106 and 107 and copy them into a workbook called "Daily Tracker 2018.xlsx" which is already open. The figures will be copied into the cell adjacent to the words Salesperson1 and Salesperson2. These words are always in column A, so the data will always be pasted into Column B but the row may vary over time.
So far I have the below, but I can't seem to find a way to search for the word Salesperson1 and paste the data into the adjacent cell. Any ideas on how to do this?
I a spreadsheet ("Sales") that tracks a total sales figure and each day is a new column. e.g. the below table.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]03/06/2018[/TD]
[TD]04/06/2018[/TD]
[TD]05/06/2018[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Sales[/TD]
[TD]50,000[/TD]
[TD]60,000[/TD]
[TD]65,000[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Costs[/TD]
[TD]10,000[/TD]
[TD]32,000[/TD]
[TD]4,000[/TD]
[/TR]
[TR]
[TD]...[/TD]
[TD].....[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]...[/TD]
[TD]....[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]...[/TD]
[TD]...[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]106[/TD]
[TD]Salesperson1[/TD]
[TD]24,000[/TD]
[TD]29,000[/TD]
[TD]36,000[/TD]
[/TR]
[TR]
[TD]107[/TD]
[TD]Salesperson2[/TD]
[TD]18,000[/TD]
[TD]18,500[/TD]
[TD]28,000[/TD]
[/TR]
</tbody>[/TABLE]
I need to find the last values in rows 106 and 107 and copy them into a workbook called "Daily Tracker 2018.xlsx" which is already open. The figures will be copied into the cell adjacent to the words Salesperson1 and Salesperson2. These words are always in column A, so the data will always be pasted into Column B but the row may vary over time.
So far I have the below, but I can't seem to find a way to search for the word Salesperson1 and paste the data into the adjacent cell. Any ideas on how to do this?
Code:
Dim Sales As Workbook
Dim Tracker As Workbook
Set Sales = Workbooks("Sales")
Set Tracker = Workbooks("Daily Tracker 2018")
Sales.Activate
Range("XFD106").Select
Selection.End(xlToLeft).Select
Selection.Copy
Tracker.Activate
Last edited: