Running that sub on the workshee4t "HardwareLiist" results in a loop
For J = 2 to 2
'Get data, put on row 2
Next j
Assuming you already had 10 rows of data the code would say
On data filled rows 2 to 11
'overwrite with new data.
Try this
Sub populateRows(HostName, Manufacturer, ModelNum, BiosVer, SerialNum, IPAddress, OSID)
'Puts data in first empty row of sheet.
With Sheets("Hardware List").Rows(Cells(Rows.Count, 1).End(xlUp).Row + 1)
'the above is only one row, so counting Cells will be counting Columns.
.Cells(1).Value = HostName
.Cells(2).Value = Manufacturer
.Cells(3).Value = ModelNum
.Cells(4).Value = BiosVer
.Cells(5).Value = SerialNum
.Cells(6).Value = IPAddress
.Cells(7).Value = OSID
End With
End Sub
Instead of using .Cells(1) in the above, you could use .Cells(1, "A"), which says "The Cell in Row 1 of the 1 row Range, Column "A"." Note that using .Cells("A") would be an undocumented feature. which should not be trusted.
With Sheets("Hardware List").Rows(Cells(Rows.Count, 1).End(xlUp).Row + 1)
is the same as
Dim NR As Long 'NR= Next Row
With Sheets("Hardware List")
NR = .Cells(Rows.Count, 1).End(xlUp).Row + 1
With .Rows(NR)
blah, blah, blah,
End With
End With