I am very new to VBA and programming in general. I am using this website right now to learn VBA.
I finished #1 and #2 successfully. The website provides a good step-by-step outline of what to do. But what it doesn't tell me is why to do that. It provides no analysis of the code or anything.
Here is the code for #2:
maxWeight = 0
For Each theCell In Range("D25:D34")
If theCell.Value > maxWeight Then
maxWeight = theCell.Value
pigNumber = theCell.Offset(0, -1).Value
MsgBox "The biggest piglet is number: " & pigNumber & " weighing:" & maxWeight
I typed it in to the VBA editor, and sure enough - I did get a popup saying pig # 1 weights the most at 10. But I do not understand how that code works. Could someone please help me understand it, line to line?