MrExcel Publishing
Your One Stop for Excel Tips & Solutions

If functions


Posted by M Walker on July 30, 2001 1:58 AM

Hi,

I'm trying to check a range of cells for aa value below a certain value. If the value is below 5 for example i would like my macro to put a cell in a list box on a user form.

Can anybodyt help me please,

Thanks in advance.

Matt


Posted by Malc on July 30, 2001 2:51 AM

Sub CheckValues
Do
RowNum=RowNum+1
if cells(RowNum,1)> 5 then
Userform1.listbox1.additem = cells(RowNum,1).value
Loop Until Cells (RowNum,1)=""
End Sub

That should work the user form and list will probably have to be displayed or the code run while the user form in in the activate or initialise stage.


Posted by M Walker on July 30, 2001 3:11 AM

Thanks alot, that will be a great help.

One more question. Is there a way of printing the list box? Or is it worth trying to export it into word and printing it off that way? If you could tell me how to emial the list box contents insted i would be very greatful.

Thanks again,

Matt