PDA

View Full Version : Solved: display results only



Sir Babydum GBE
08-08-2007, 09:50 AM
Hi,

Column A of sheet 2 contains formulas that display either a result or return an empty string

How do I get a macro to look at column A of Sheet 2 (rows 2 to 30) and display a message box with a header "Results" showing only the results and not the empty strings?

If there are only empty strings the macro goes onto do something else - if there are results it will quit after user clicks "ok"

rory
08-08-2007, 10:41 AM
Something like:
Dim n as Long, strValues as string
for n = 2 to 30
If Len(Cells(n, "A").Value ) > 0 Then strValues = strvalues & vbcrlf & Cells(n, "A").Value
next n
if len(strvalues) = 0 then
Exit Sub
else
Msgbox "Results:" & strvalues
End If

Sir Babydum GBE
08-08-2007, 10:49 AM
Brilliant!