dimanche 22 mars 2015

Need MsgBox to display excel cells next to cells in an array

Here is the code:



For R = 5 To 145
If Worksheets("CHPSpecs").Cells(R, 4).Value >= 0.9 * CHPSize And Worksheets("CHPSpecs").Cells(R, 4).Value <= 1.1 * CHPSize Then
j = 0
ReDim Preserve eleOutput(j)
eleOutput(j) = Worksheets("CHPSpecs").Cells(R, 3).Value
End If
Next R

For j = LBound(eleOutput) To UBound(eleOutput)
If eleOutput(j) <= compareNum Then
MsgBox ???????
End If
Next j


I took away some of the code for better viewing, but this is the chunk I'm having troubles with. So I'm having VBA look down a specified column and if the value in those cells match the criteria, then they get stored in an array called eleOutput(j).


Then, I want to compare the array to a variable "compareNum" and if this the If statement is true, I want to MsgBox the cells next to the cells that are contained in the array eleOutput(j).


Assuming everything is "dim'd" and the If statements are done correctly, what do I put in place of "???????" to have the code output what I want?


Thank you for your time!


Aucun commentaire:

Enregistrer un commentaire