View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Felicity Geronimo Felicity Geronimo is offline
external usenet poster
 
Posts: 11
Default If statement not working properly

Hi,

I do want to check each cell in the selected column (apart from the
first cell which is the column heading)Is this easy?

Regards

Felicity


"JulieD" wrote in message ...
Hi Felicity

you say "I want the code to let me know if the cell contains .."
however you're selecting a column and not a cell
do you want to check all the cells in the column - if so, you will need to
cycle through each cell and test it
or do you want to select one cell and check that?

Cheers
JulieD


"Felicity Geronimo" wrote in message
om...
I have written the following code but it doesnt work, please can you
help?

Sub CSV_Dept_Checker()

'selects column F
Sheets("Dept").Columns(6).Select

If (Cells.Select < Null) Or (Cells.Select < "Y") Then

MsgBox "Data is formatted correctly"

Else

MsgBox "Incorrect data"

End If

End Sub

Basically all i want to do, is once a file has been creted, run the
above code and I want the code to let me know if the cell contains
anything other that nothing or "Y". If Null or "Y" then give me
message "Data is formatted correctly" if anything else "Incorrect
data"

Why does this not work?

Thanks
Felicity