Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel: Making sure there is numeric data in one column 1

Status
Not open for further replies.

mmtraining

IS-IT--Management
Mar 18, 2002
104
DE
In a table people fill in information about costs. If they are not sure, they either leave the cell free or write some text or put in a question mark.

I want to find out if the cell next door contains information. If yes, check this cell to see if the contents is numeric and larger than 0, if not larger than zero or if not numeric, then put in a zero. If the cell next door is empty then stop running. Otherwise loop.

My question: How can I check the cell next door (to the left) to see if it contains data? I know I use isempty, but how do I address the cell? I am a bit weak on RANGE and CELLS, sorry.

Thanx for any ideas :)

Carol
Berlin, Germany
 
Use
Cell_Ref.offset(0,-1).value

to access the cell to the left so, if you were checking B10, you would use

If Range("B10").offset(0,-1).text = "" then
'A10 is empty
else
'A10 has data
end if

HTH Rgds
Geoff

Si hoc legere scis, nimis eruditionis habes
 
xlbo, thanx a lot, not only for this answer but also for the other one. :)

It is very helpful to have you and the others.

Carol
Berlin, Germany
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top