FALSE instead of null in cell

jarhead58

Active Member
Joined
Sep 21, 2017
Messages
348
Office Version
  1. 2016
Platform
  1. Windows
Hello gang!

Quick question hopefully with a simple answer. Why would I get a FALSE in a cell that I set = to ""? This is in a Select Case statement. TIA
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Only as long as it works, I could easily have missed something.
 
Upvote 0
It works great for 12 episodes. What would I use to allow it to increment E6 if other seasons have say 14 after season 8?
 
Upvote 0
How about
Code:
Sub jarhead58()
    With Sheets("Sheet1")
        Select Case Range("E3").Value
            Case Is < 9
                If .Range("E6") = 12 Then
                    .Range("E6").Value = ""
                    .Range("E3").Value = .Range("E3").Value + 1
                Else
                    .Range("E6").Value = .Range("E6").Value + 1
                    If IsEmpty(.Range("$E3")) = True Then
                        .Range("$E3").Value = .Range("$E3").Value + 1
                    End If
                End If
            Case Is > 8
                If .Range("E6") = 14 Then
                    .Range("E6").Value = ""
                    .Range("E3").Value = .Range("E3").Value + 1
                Else
                    .Range("E6").Value = .Range("E6").Value + 1
                    If IsEmpty(.Range("$E3")) = True Then
                        .Range("$E3").Value = .Range("$E3").Value + 1
                    End If
                End If
        End Select
    End With
End Sub
 
Upvote 0
How about
Code:
Sub jarhead58()
    With Sheets("Sheet1")
        Select Case Range("E3").Value
            Case Is < 9
                If .Range("E6") = 12 Then
                    .Range("E6").Value = ""
                    .Range("E3").Value = .Range("E3").Value + 1
                Else
                    .Range("E6").Value = .Range("E6").Value + 1
                    If IsEmpty(.Range("$E3")) = True Then
                        .Range("$E3").Value = .Range("$E3").Value + 1
                    End If
                End If
            Case Is > 8
                If .Range("E6") = 14 Then
                    .Range("E6").Value = ""
                    .Range("E3").Value = .Range("E3").Value + 1
                Else
                    .Range("E6").Value = .Range("E6").Value + 1
                    If IsEmpty(.Range("$E3")) = True Then
                        .Range("$E3").Value = .Range("$E3").Value + 1
                    End If
                End If
        End Select
    End With
End Sub

Thats awesome, thank you!! I would just add a case for any other season that differs correct?
 
Upvote 0
That's right, also if seasons 1-8, 11 & 15 were 12 episodes & seasons 9-10,12-4 & 16 were 14 episodes you can use it like
Code:
    With Sheets("Sheet1")
        Select Case Range("E3").Value
            Case 1 To 8, 11, 15
                If .Range("E6") = 12 Then
                    .Range("E6").Value = ""
                    .Range("E3").Value = .Range("E3").Value + 1
                Else
                    .Range("E6").Value = .Range("E6").Value + 1
                    If IsEmpty(.Range("$E3")) = True Then
                        .Range("$E3").Value = .Range("$E3").Value + 1
                    End If
                End If
            Case 9, 10, 12 To 14, 16
                If .Range("E6") = 14 Then
                    .Range("E6").Value = ""
                    .Range("E3").Value = .Range("E3").Value + 1
                Else
                    .Range("E6").Value = .Range("E6").Value + 1
                    If IsEmpty(.Range("$E3")) = True Then
                        .Range("$E3").Value = .Range("$E3").Value + 1
                    End If
                End If
        End Select
    End With
 
Upvote 0
That's right, also if seasons 1-8, 11 & 15 were 12 episodes & seasons 9-10,12-4 & 16 were 14 episodes you can use it like
Code:
    With Sheets("Sheet1")
        Select Case Range("E3").Value
            Case 1 To 8, 11, 15
                If .Range("E6") = 12 Then
                    .Range("E6").Value = ""
                    .Range("E3").Value = .Range("E3").Value + 1
                Else
                    .Range("E6").Value = .Range("E6").Value + 1
                    If IsEmpty(.Range("$E3")) = True Then
                        .Range("$E3").Value = .Range("$E3").Value + 1
                    End If
                End If
            Case 9, 10, 12 To 14, 16
                If .Range("E6") = 14 Then
                    .Range("E6").Value = ""
                    .Range("E3").Value = .Range("E3").Value + 1
                Else
                    .Range("E6").Value = .Range("E6").Value + 1
                    If IsEmpty(.Range("$E3")) = True Then
                        .Range("$E3").Value = .Range("$E3").Value + 1
                    End If
                End If
        End Select
    End With

(y)
You know I had an elder moment! I completely forgot about using the multiple items in Case!!!
I guess in the beginning, I was somewhat on the right track lol!!

Thank you again Fluff!!
 
Upvote 0

Forum statistics

Threads
1,213,552
Messages
6,114,278
Members
448,560
Latest member
Torchwood72

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