Question: I'm trying to write a macro that matches a cell in the with the sheet name and then pulls data from that sheet and then copies it in the next column with the initial sheet. Here's what I have so far:

```
Sub example() 

 Dim wkSht As Worksheet

  For Each wkSht In Sheets

    For Each Cell In Sheets("Reporting").Range("B2:B200")

        If Cell.Value = wkSht.Name Then

            On Error Resume Next

            wkSht.Range("D15").Copy Destination:=Sheets("Reporting").Range("c2:c36")

        End If

    Next Cell

 Next wkSht

End Sub

```

I want to do that for the whole column but I don't know the code for copying it in the next column over. Basically, it would match the `Cell (B2)` with the sheet tab name and then pull from the same cell in that respective tab and then copy to the next `column (C2)`. And I would do that for `b3`, `b4`, `b5`, till `b200`. Thanks!

Answer: 
```
var array = ["heehjko", "oient", "ana", "inm", "mii", "dgdgdfg", "Dove"]

var lower = []
for (let i = 0; i < array.length; i++) {
    lower.push(array[i].toLowerCase());
}
console.log(lower)
var testA = []
var count = 0;

for (var i = 0; i < lower.length; i++) {
    var j = 1;
    console.log(lower[i].charAt(lower[i].length - 1))
    console.log(lower[i + 1])
    if (lower[i + 1] != undefined) {
        if (lower[i].charAt(lower[i].length - 1) === lower[i + 1].charAt(0)) {

            testA.push(lower[i + 1]);
        }
    }

}
console.log(testA)

```
Your code is absolutely Ok
==========================

Loop is not looping 1 time. It looping as lower.length and lower.length is 3.
Your if condition 

```
if(lower[i].charAt(lower[i].length-1) === lower[j].charAt(0))

```

is get true one time. So that your counter value return 1.If set the counter outside of if condition you will see it

```
for(var i = 0; i < lower.length; i++) {
var j = 1;
if(lower[i].charAt(lower[i].length-1) === lower[j].charAt(0)){
    testA.push(lower[i]);
    j = j + 1;

} 
count = count + 1;
} 
return count;

```