Tim_Excel_
Well-known Member
- Joined
- Jul 12, 2016
- Messages
- 512
I have an Array that I use to populate rows in a Worksheet
I want to pull the nth value from RArray and print it to the immediate window or use it for other lines of code. However, when I use
the immediate window doesn't show "M", but whatever value was last mentioned from that array. For example, if I were to do
run this, remove the top line and run it again, the debug window still shows "othervalue" even though this line no longer exists.
Code:
If rng1.Offset(0, 4) <> "" Then PValue = "DAYS" Else PValue = "ADHOC" If rng1.Offset(0, 5) = "PREVENTIVE" Or rng1.Offset(0, 5) = "REACTIVE" Then AGValue = "PART" Else AGValue = "CUSTOMER"
If rng1.Offset(0, 5) = "PREVENTIVE" Or rng1.Offset(0, 5) = "REACTIVE" Then AHValue = "EU-SERV-ENG-M" Else AHValue = "CUST-MECH"
Dim RArray As Variant
RArray = Array("M", Cells(cell.Row, 2) & "_" & rng1.Offset(0, 1), "", Cells(cell.Row, 9) & rng1.Offset(0, 2), Cells(cell.Row, 9) & rng1.Offset(0, 2), _
"", "0", rng1.Offset(0, 3), "1", "?", "?", "0", rng1.Offset(0, 4), "", "NORM", PValue, "0", "0", "0", "", "0", "0", "0", "0", "1", "1", "1", "0", "0", "", "", rng1.Offset(0, 5), AGValue, AHValue, _
"UNKNOWN", "", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN")
I want to pull the nth value from RArray and print it to the immediate window or use it for other lines of code. However, when I use
Code:
Debug.Print RArray(0)
Code:
RArray(0) = "othervalue"
Debug.Print RArray(0)