IF STATEMENTS FOR THE FOLLOWING RULES

P

paul

i want to set a variable colour using an if statement, but this will
depend upon the values stored in the variables Landcover and slope
depending upon these rules:

colour is to be set to 1 if LandCover is less then 4 and slope is less
then 10

colour is to be set to 2 if LandCover is less then 10 but greater then
or equal to 4 and slope is less then 10

colour is to be set to 3 if slope is greater then 10
 
M

Mike H

Paul,

This follows the rules you define but there are many cases where colour will
be empty. One example is when landcover=4.

Sub pickacolour()
If landcover < 4 And Slope < 10 Then
colour = 1
ElseIf landcover > 4 And lancover < 10 And Slope < 10 Then
colour = 2
ElseIf Slope > 10 Then
colour = 3
End If
End Sub

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top