I might be wrong, but I think it is because you have linked your cells only at the time the vba macro runs?
Sub PopulateTestsExecuted()
' Populates the Summary sheet with the tests executed per component
Dim i As Integer, component As String, goHere As Range, fromHere As Range
With frmGetSetUpData.lstComponents
Set goHere = Sheets("Summary").Range("K4")
For i = 0 To .ListCount - 1
component = .List(i)
Set fromHere = Sheets(component).Range("G7")
goHere = fromHere
Set goHere = goHere.Offset(i, 0)
Next i
End With
End Sub
My evaluation of what your code is doing it that you are basically starting at K4 on your summary sheet, and copying to that the value from G7 of the 'component' sheet.
On the next loop the value is copied into K5 from G7 of THAT component, and so on, moving row by row down the summary sheet?
If this is the case then the reason it only works once is because you are assigning the VALUE at the moment the macro is run, where as if you want to update all the time you need to make the cell contain a formuala.
I would adjust your code as follows using the R1C1 format of addressing Rows and Columns. (I have commented your lines of code so that you can hopefully see which lines my new code is related to)
Sub PopulateTestsExecuted()
' Populates the Summary sheet with the tests executed per component
Dim index As Integer
Dim component As String
Dim goHere_row as Long
'Set goHere = Sheets("Summary").Range("K4")
goHere_row = 4 ' Row is 4, column will be 11, which is column K
With frmGetSetUpData.lstComponents
For index = 0 To .ListCount - 1
component = .List(index)
'Set fromHere = Sheets(component).Range("G7")
'goHere = fromHere
Worksheets("Summary").Cells(goHere_row, 11).formula= "='" & component & "'!G7" ' Remember the single quotes!
'Set goHere = goHere.Offset(i, 0)
goHere_row = goHere_row + 1 ' NOTE I don't think your line above would have done this, as the first time it would have offset by 1 row from it's current position, the next time 2 rows, then 3 etc as 'i' increased.
Next index
End With
End Sub
Note the single quotes included in the 'formula' line. These will cause the name of the worksheet to be enclosed in single quotes which allows for the fact that component might include an embedded space character.
EDITED I got my rows and columns the wrong way around. Now corrected
Bookmarks