Need help with Excel Macro

minendo

Elite Member
Aug 31, 2001
35,560
22
81
We are trying to get a macro running which reads and records information from a scale. I've been able to get it to read the information from the scale and put it into the specified cell, but I need to be able to do this 10 times and each time entering it into cell An where n=1 to 10. I am pretty sure I will need to use a for loop which I can set up and run properly, but I can't figure out how to print the recorded information to the specified cell.

Sample of my current code:

 

PowerEngineer

Diamond Member
Oct 22, 2001
3,600
775
136
Well, I may be misunderstanding the problem but ...

If Excel is going to pause for another scale reading each time it hits MTWeight1.GrossWeight then you could use the following:

Private Sub MTWeight1_NewWeight()
Dim Index as Integer
For Index = 1 to 10
Sheet1.Cells(Index, 1).Value = MTWeight1.GrossWeight
Next Index
End Sub

You might want to look into using named ranges for data arrays like the one you are creating. If "Test" is the name of the range, then: [Test].Cells(Index,1).Value = ...

Good Luck!