BGerm
02-04-2020, 06:03 AM
Is it possible to search by header column in VBA?
Desired goal is when header is found, copy whole column to sheet2. Headers should be copied in order of their appearance in headers column. After 3 columns copied, blank column should be inserted, then next 3, then again blank column, and so on..
I managed to do it when headers are in list. But I am struggling when they are in column, not so experienced in VBA.
Headings
N37
D100556
10
338
N61
ND200011
7100339
100557
L000012
NLJD100340
JD1055
GUNJD100335
3
4
4
4
4
4
4
4
4
4
4
JD1055
4
5
5
5
5
5
5
5
5
5
5
LJD200008
5
10
7
10
7
10
7
10
7
10
7
N88LKG
7
9
8.33
9
8.33
9
8.33
9
8.33
9
8.33
N60
8.33
4
9.83
4
9.83
4
9.83
4
9.83
4
9.83
N0009
9.83
5
11.33
5
11.33
5
11.33
5
11.33
5
11.33
N37
11.33
10
12.83
10
12.83
10
12.83
10
12.83
10
12.83
D100556
12.83
9
14.33
9
14.33
9
14.33
9
14.33
9
14.33
B10
14.33
12
15.83
12
15.83
12
15.83
12
15.83
12
15.83
C338
15.83
14
17.33
14
17.33
14
17.33
14
17.33
14
17.33
N61
17.33
16
18.83
16
18.83
16
18.83
16
18.83
16
18.83
ND200011
18.83
18
20.33
18
20.33
18
20.33
18
20.33
18
20.33
K7100339
20.33
20
21.83
20
21.83
20
21.83
20
21.83
20
21.83
J100557
21.83
22
23.33
22
23.33
22
23.33
22
23.33
22
23.33
L000012
23.33
24
24.83
24
24.83
24
24.83
24
24.83
24
24.83
NLJD100340
24.83
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
Desired goal is when header is found, copy whole column to sheet2. Headers should be copied in order of their appearance in headers column. After 3 columns copied, blank column should be inserted, then next 3, then again blank column, and so on..
I managed to do it when headers are in list. But I am struggling when they are in column, not so experienced in VBA.
Headings
N37
D100556
10
338
N61
ND200011
7100339
100557
L000012
NLJD100340
JD1055
GUNJD100335
3
4
4
4
4
4
4
4
4
4
4
JD1055
4
5
5
5
5
5
5
5
5
5
5
LJD200008
5
10
7
10
7
10
7
10
7
10
7
N88LKG
7
9
8.33
9
8.33
9
8.33
9
8.33
9
8.33
N60
8.33
4
9.83
4
9.83
4
9.83
4
9.83
4
9.83
N0009
9.83
5
11.33
5
11.33
5
11.33
5
11.33
5
11.33
N37
11.33
10
12.83
10
12.83
10
12.83
10
12.83
10
12.83
D100556
12.83
9
14.33
9
14.33
9
14.33
9
14.33
9
14.33
B10
14.33
12
15.83
12
15.83
12
15.83
12
15.83
12
15.83
C338
15.83
14
17.33
14
17.33
14
17.33
14
17.33
14
17.33
N61
17.33
16
18.83
16
18.83
16
18.83
16
18.83
16
18.83
ND200011
18.83
18
20.33
18
20.33
18
20.33
18
20.33
18
20.33
K7100339
20.33
20
21.83
20
21.83
20
21.83
20
21.83
20
21.83
J100557
21.83
22
23.33
22
23.33
22
23.33
22
23.33
22
23.33
L000012
23.33
24
24.83
24
24.83
24
24.83
24
24.83
24
24.83
NLJD100340
24.83
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3