Looping Data = TRUE to a MsgBox

  • Thread starter Thread starter JMay
  • Start date Start date
J

JMay

Could someone provide an example of Looping thru a range of 20 records
and where say 5 records = True, and 15 = False; On completion a Msgbox
would Pop-up
stacking the results as follows:

TrueCell1.Address TrueCell1.Value << ... & Chr (10) &... is involved
here (I think).
TrueCell2.Address TrueCell2.Value
TrueCell3.Address TrueCell3.Value
TrueCell4.Address TrueCell4.Value
TrueCell5.Address TrueCell5.Value

Sorry not to have all required data, but any
help would be appreciated.

TIA,
 
sStrTrue = " - True - " & vbNewLine
sStrFalse = " - False - " & vbNewLine
for each cell in Range("A1:A20")
if cell.Value then
sStrTrue = sStrTrue & cell.Address & " " & cell.Value & vbNewLine
else
sStrFalse = sStrFalse & cell.Address & " " & cell.Value & vbNewline
End if
Next
msgbox sStrTrue & sStrFalse

if you want them spaced exactly in columns, that would take a bit more work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top