i have this kind of data in excel file
Datasheet.xlsxPHP Code:
Exportfile.xlsx
A B
1) Head 31-Dec-2017
2) a 23
3) b 45
4) c 46
And in datasheet data like this
PHP Code:
1) A
2) QUARTER Data
3) 31 Mar 2017
4) 30 Jun 2017
5) 30 Sep 2017
6) 31 Dec 2017
7)
8)
9) B
10) QUARTER Data
11) 31 Mar 2017
12) 30 Jun 2017
13) 30 Sep 2017
14) 31 Dec 2017
15)
16)
17) C
18)QUARTER Data
19) 31 Mar 2017
20) 30 Jun 2017
21) 30 Sep 2017
22) 31 Dec 2017
now i want to paste values from exportfile to datasheet and want data like this
now i do this codePHP Code:
1) A
2) QUARTER Data
3) 31 Mar 2017
4) 30 Jun 2017
5) 30 Sep 2017
6) 31 Dec 2017 23
7)
8)
9) B
10) QUARTER Data
11) 31 Mar 2017
12) 30 Jun 2017
13) 30 Sep 2017
14) 31 Dec 2017 45
15)
16)
17) C
18) QUARTER Data
19) 31 Mar 2017
20) 30 Jun 2017
21) 30 Sep 2017
22) 31 Dec 2017 46
NextPHP Code:
Sub copy_data(File_Name)
For i = 2 To 4
Windows("Exportfile.xlsx").Activate
Sheets("ESheet").Select
Cells(i, 2).Select
Selection.Copy
Windows(File_Name).Activate
Sheets("Dsheet").Select
On Error Resume Next
**j = '' here what i do**
Cells(j, 2).Select
On Error Resume Next
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
now in above code on J line what should i do so values copy from export file and paste in datasheet in quarter 31 Dec 2017 through loop
any solution ?
Bookmarks