Hi watersev
Thank you for the code. It works brilliantly. Very short code. You should see mine with like bazillion lines.
If you have some time I would like to understand and learn from the code so I can use it with some other sheets. Can we break the code to pieces. I would really like to learn from it.
Full code
x = .Range(.[af2], .Cells(Rows.Count, "a").Offset(, 32))
1) Why is this af2 column chosen? Its not the beginning or the end on either sheets, its kinda in middle of both and does not contain any specific information. I also noticed column af also happens to be column 32. Any connection between these two? What is the function for this line? How does it operate?
"SELECT T1.F27,T1.F10,T1.F39,T1.F1,T1.F1,T1.F9,T1.F29,T1.F11,T1.F31,T1.F35,T1.F36,T1.F37 FROM [zflex$A2:AL65536]
2) T1.Fxx - xx stands for the respective column from the source sheet (zflex), correct yes? And F1 will leave columns blank/untouched, correct?
3) [zflex$A2:AL65536] - this is just a source area correct? If I would like it to extend further I would change the value of AL65536 to something else?
T1 LEFT OUTER JOIN [KHL_YM26$A2:A65536] T2 ON T1.F1=T2.F1", cn, adOpenStatic, adLockOptimistic
[ac2].CopyFromRecordset rs:
4) I don't understand which line on the code is actually marrying up column Z on source sheet and column A from destination sheet? I don't have clue for the either one? My only guess is that it is to do with something in this line above. What and how would I have to change on the code if it would be different parameters? Like instead column A It would be column C that I would be matching up with column E on source sheet etc.
[ac2].CopyFromRecordset rs:
5) Is ac2 where it starts to count columns to be replaced i.e. T1, T2, T3. T1 = AC2, T2 = AD2, T3 = AE2 etc... Correct?
If you could help me to learn from this code I would be very happy as I would like to repeat the same method with some other reports.
Kind regards
Rain
Bookmarks