A workbook named "Report" has 2 sheets "Main File" and "DBR Report".
After sorting the data, it is pasted to the Main File .
The DBR Report has 2 Columns already updated with data which are -
Column A reflects as below (One below the other) :
FR:
TO:
FR:
TO:
FR:
TO:
Column B reflects BA from Cell B4 onwards.
The macro should do the following :
1) Copy data from Main File to DBR Report to rows reflecting FR:
Leaving Rows reflecting TO: as blanks
(Simply put the data should be copied to rows which reflect FR: in DBR Report.
2) Data should be copied as below :
[TABLE="width: 500"]
[tr]
[td]
From Main File
[/td]
[td]
To DBR Report
[/td]
[/tr]
[tr]
[td]
Column A
[/td]
[td]
Column R
[/td]
[/tr]
[tr]
[td]
Column B and C
[/td]
[td]
Column H and I (Explanation below - a)
[/td]
[/tr]
[tr]
[td]
Column D
[/td]
[td]
Column C (Explanation below - b)
[/td]
[/tr]
[tr]
[td]
Column F
[/td]
[td]
Column D
[/td]
[/tr]
[tr]
[td]
Column H
[/td]
[td]
Column E
[/td]
[/tr]
[tr]
[td]
Column J
[/td]
[td]
Column F
[/td]
[/tr]
[tr]
[td]
Column L
[/td]
[td]
Column G
[/td]
[/tr]
[tr]
[td]
Column N
[/td]
[td]
Column J, K, L, M, N, O and P (Explanation below - c)
[/td]
[/tr]
[/TABLE]
a) Column B and C contains date which should be copied to DBR Report in a different format
[TABLE="width: 500"]
[tr]
[td]
From Main File
[/td]
[td]
To DBR Report
[/td]
[/tr]
[tr]
[td]
20150828
[/td]
[td]
28-Aug-15
[/td]
[/tr]
[tr]
[td]
20150831
[/td]
[td]
31-Aug-15
[/td]
[/tr]
[/TABLE]
b) Column D contains Numbers which which should be copied to DBR Report in a different format
[TABLE="width: 500"]
[tr]
[td]
From Main File
[/td]
[td]
To DBR Report
[/td]
[/tr]
[tr]
[td]
0001
[/td]
[td]
1
[/td]
[/tr]
[tr]
[td]
0012
[/td]
[td]
12
[/td]
[/tr]
[tr]
[td]
0123
[/td]
[td]
123
[/td]
[/tr]
[tr]
[td]
1234
[/td]
[td]
1234
[/td]
[/tr]
[/TABLE]
c)Column N contains weekdays in number format, i.e Mon to Sun will be 1 to 7
which should be copied to DBR Report under Columns J, K, L, M, N, O and P
[TABLE="width: 500"]
[tr]
[td]
Column O in Main File
[/td]
[/tr]
[tr]
[td]
17
[/td]
[/tr]
[tr]
[td]
234
[/td]
[/tr]
[tr]
[td]
56
[/td]
[/tr]
[/TABLE]
How above data should reflect in DBR Report
[TABLE="width: 500"]
[tr]
[td]
J
[/td]
[td]
K
[/td]
[td]
L
[/td]
[td]
M
[/td]
[td]
N
[/td]
[td]
O
[/td]
[td]
P
[/td]
[/tr]
[tr]
[td]
1
[/td]
[td][/td]
[td][/td]
[td][/td]
[td][/td]
[td][/td]
[td]
7
[/td]
[/tr]
[tr]
[td][/td]
[td]
2
[/td]
[td]
3
[/td]
[td]
4
[/td]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[td][/td]
[td]
5
[/td]
[td]
6
[/td]
[td][/td]
[/tr]
[/TABLE]
7) Since the report is generated for 2 agents (code is AA and US) need two buttons,one for AA and one for US.
Clicking on AA button will -
a) Update data in DBR Report as mentioned above and Column Q reflecting as AA from Cell 4 Onwards
Clicking on US button will -
b) Update data in DBR Report as mentioned above and Column Q reflecting as US from Cell 4 Onwards
Sample sheet has been attached to give an idea how Main File looks like and DBR Report should look like
after the macro is run.