If...Then...Else Query

ianian

New Member
Joined
May 29, 2012
Messages
21
Hi,

I used this code today:

SubShoe ()

Dim Shoe1 As Range

Set Shoe1 = Range("A20:A70").Find(what:="Shoes").Offset(2,0)
If Shoe1.Value <> " " Then

ElseIf Shoe1.Value = " " Then

End If

End Sub

However my code stops executing before the ElseIf command although Shoe1.Value is = " ". Can someone please advise?

Thank you!
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
There is a space between the quotes
Shoe1.Value = " "

This is not testing if Shoe1.Value is blank or empty. It is testing if it is equal to exactly one space character.

Try something like this...
Code:
[color=darkblue]If[/color] Shoe1.Value <> "" [color=darkblue]Then[/color]
   [color=green]'Shoe1 is not empty[/color]
   [color=green]'Note: no space between quotes[/color]
[color=darkblue]Else[/color]
   [color=green]'Shoe1 is empty[/color]
[color=darkblue]End[/color] [color=darkblue]If[/color]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,203,485
Messages
6,055,688
Members
444,807
Latest member
RustyExcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top