# Question

## Recommended Posts

`If \$Celsius = 1 or 2 or 3 or 4 Then`

I know this won't work. Is there any way to do: If \$Celsius = 1 through 4? 1 or 2 etc. Is not working, I can't figure it out for some reason. Any help would be great.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

##### Share on other sites
```If \$Celsius = 1 or 2 or 3 or 4 Then oÝ÷ ØêÚºÚ"µÍÝÚ]Ú    ÌÍÐÙ[Ú]ÂØÙHBËØÙHËØÙHÂËØÙH
Ë[ÝÚ]Ú```
Edited by Paulie

##### Share on other sites

`If \$Celsius = 1 or 2 or 3 or 4 Then`

I know this won't work. Is there any way to do: If \$Celsius = 1 through 4? 1 or 2 etc. Is not working, I can't figure it out for some reason. Any help would be great.

If I interpret your problem correctly:

If \$Celsius > 0 Or \$Celsius < 5 Then

; What to do when Celsius is 1, 2, 3, or 4.

EndIf

...should be sufficient, as long as you're dealing with integers and not floating point numbers.

You might also lookup StringRegExp() for some ways to really dial in your If tests.

-S

Edited by Locodarwin

(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]

##### Share on other sites

If \$Celsius > 0 And \$Celsius < 5 Then

because

If \$Celsius > 0 or \$Celsius < 5 Then

wont work

8)

Edited by Valuater

##### Share on other sites

Thanks a lot Valuater

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Welcome!

8)

##### Share on other sites

Another question, so I can understand this for later use.

```\$Code = "48313"
\$File = _TempFile()
INetGet("http://www.weather.com/weather/local/" & \$Code, \$File, -1, 0)
\$LineA = StringSplit(\$Line, "")
;Get city and state name, 34 from left, 22 from the right
\$CityNameA = StringTrimLeft(\$Title, 34)
\$CityName = StringTrimRight(\$CityNameA, 22)
\$Fahrenheit = \$LineA[38] & \$LineA[39] & " °F"; Temperature 38, 39```

Is there a way to look the file that you used INetGet, so I can choose what lines I want to read, other then guessing numbers?

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

##### Share on other sites

Whoops, replace the OR with an AND!

Thanks for catching my goof, Valuator.

-S

(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]

## Create an account

Register a new account

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...