MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Correct Statment in VB?

Posted by Chris on September 24, 2001 12:25 PM

I'm trying to get the program to convert Directions, (N,S,E,W) into degrees and then average them and convert the output back into Directions.
So far I can get it to convert the directions into degrees, but I have to be able to know if the second number is greater than 180. If that's the case than the Value for North needs to be 360 instead of 0.
Obviously I'm new to programing.
Here's what I wrote. Can anyone tell me what it needs to be so that it will work?

If Cells(x,9).Value = 0 and Cells(x+1,9).Value is >180 Then Cells(x,9).Value = 360

This is, of course, after I have already changed the Value of North to 0.

Posted by Ron on September 24, 2001 2:09 PM

If Cells(x, 9).Value = 0 And Cells(x + 1, 9).Value > 180 Then Cells(x, 9).Value = 360