For I = 1 To numberMeasurements
SendSCPI "DATA:REMOVE? 1" ’ Request 1 reading from memory
Cells(I + 3, 1) = I ’ The reading number
Cells(I + 3, 2) = Val(getScpi()) ’ The reading value
Do ’ Wait for instrument to put another reading in memory
SendSCPI "DATA:POINTS?" ’ Get the number of readings stored
points = Val(getScpi())
Loop Until points >= 1 Or I >= numberMeasurements
Next I
ClosePort ’ Close communications on GPIB
End Sub