Claus Busch wrote:
Hi Terry,
Am Wed, 29 Jan 2020 11:21:00 +0000 schrieb Terry Pinnell:
I have a string variable 'tAll_VBA' in my workbook 'WalkIndex.xlsm',
sheet 'Target'. It contains 21 values on 21 separate lines, all ending
in a CR/LF character. I want to copy all except the first two lines to
19 specified columns of the first empty row of the worksheet (i.e col A
empty). The variable and target cols are as follows:
Col Line
1
2
C 3
A 4
B 5
J 6
K 7
L 8
I 9
M 10
H 11
N 12
O 13
P 14
R 15
S 16
T 17
V 18
U 19
W 20
Y 21
try:
strCols = "C,A,B,J,K,L,I,M,H,N,O,P,R,S,T,V,U,W,Y"
varCols = Split(strCols, ",")
varTmp = Split(tAll_VBA, Chr(10))
For i = 2 To UBound(varTmp)
Sheets("Target").Cells(i + 1, varCols(i - 2)) = varTmp(i)
Next
Regards
Claus B.
Thanks Claus, very grateful for your help. I'm confident your code is
VERY close to working but it's giving some incorrect results at present.
I've included a link to the test workbook WalkIndex-Claus.xlsm so that
you can see what I mean in detail. Should have done that in my original
post, sorry.
https://www.dropbox.com/s/xbwgtqs23z...aus.xlsm?raw=1
Terry, East Grinstead, UK