Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following
Set iSect = Application.Intersect(Range("UserName"), Target) If Not iSect Is Nothing Then For Each tCell In iSect If tCell.Value < UCase(tCell.Value) Then tCell.Value = UCase(tCell.Value) If Len(Trim(tCell.Value)) = 0 Then tCell.Value = "Enter Name" If Len(Trim(tCell.Value)) = 0 Then Call DefaultValueMsg End If Next End If How can I correct this so the last two IF statements work. The first portion works fine. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'll assume that by 'work', you mean that both 'then' clauses get executed.
As it's set up, when you put "Enter Name" in the cell, you guarantee that the next test (length = 0) will fail. Set it so that you only make the decision once, executing both statements if the length is 0: If Len(Trim(tCell.Value)) = 0 Then tCell.Value = "Enter Name" Call DefaultValueMsg End iF (That all replaces the two lines that begin if len(trim(tcell.value)) = 0). "Matt" wrote: I have the following Set iSect = Application.Intersect(Range("UserName"), Target) If Not iSect Is Nothing Then For Each tCell In iSect If tCell.Value < UCase(tCell.Value) Then tCell.Value = UCase(tCell.Value) If Len(Trim(tCell.Value)) = 0 Then tCell.Value = "Enter Name" If Len(Trim(tCell.Value)) = 0 Then Call DefaultValueMsg End If Next End If How can I correct this so the last two IF statements work. The first portion works fine. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Multiple IF statements looking up multiple ranges. | Excel Worksheet Functions | |||
Multiple AND & OR statements | Excel Worksheet Functions | |||
Multiple if statements I think | Excel Worksheet Functions | |||
Multiple if statements with multiple conditions | Excel Discussion (Misc queries) | |||
How to: Multiple "if" statements? | New Users to Excel |