Beachcomber1224
New Member
- Joined
- May 12, 2011
- Messages
- 18
Hello,
I have the following script, but am having trouble looping it. There are basically three parts that I have condensed. Does anyone have suggestions on looping this until there is nothing in next column's 138 cell? Below is the condensed version of my script. Thanks for any help!
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Sheet1.Range("B5").Value
Case 1 To 4
Sheet1.Range("B72").Value = Sheet1.Range("B5").Value - 1
Case Else
Sheet1.Range("B72").ClearContents
End Select
Select Case Sheet1.Range("B6").Value
Case 1 To 4
Sheet1.Range("B73").Value = Sheet1.Range("B6").Value - 1
Case Else
Sheet1.Range("B73").ClearContents
End Select
Select Case Sheet1.Range("B15").Value
Case 1
Sheet1.Range("B82").Value = 3
Case 2
Sheet1.Range("B82").Value = 2
Case 3
Sheet1.Range("B82").Value = 1
Case 4
Sheet1.Range("B82").Value = 0
Case Else
Sheet1.Range("B82").ClearContents
End Select
Select Case Sheet1.Range("B16").Value
Case 1
Sheet1.Range("B83").Value = 3
Case 2
Sheet1.Range("B83").Value = 2
Case 3
Sheet1.Range("B83").Value = 1
Case 4
Sheet1.Range("B83").Value = 0
Case Else
Sheet1.Range("B83").ClearContents
End Select
Range("B138").FormulaR1C1 = "=SUM(R[-66]C:R[-2]C)"
End Sub
I have the following script, but am having trouble looping it. There are basically three parts that I have condensed. Does anyone have suggestions on looping this until there is nothing in next column's 138 cell? Below is the condensed version of my script. Thanks for any help!
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Sheet1.Range("B5").Value
Case 1 To 4
Sheet1.Range("B72").Value = Sheet1.Range("B5").Value - 1
Case Else
Sheet1.Range("B72").ClearContents
End Select
Select Case Sheet1.Range("B6").Value
Case 1 To 4
Sheet1.Range("B73").Value = Sheet1.Range("B6").Value - 1
Case Else
Sheet1.Range("B73").ClearContents
End Select
Select Case Sheet1.Range("B15").Value
Case 1
Sheet1.Range("B82").Value = 3
Case 2
Sheet1.Range("B82").Value = 2
Case 3
Sheet1.Range("B82").Value = 1
Case 4
Sheet1.Range("B82").Value = 0
Case Else
Sheet1.Range("B82").ClearContents
End Select
Select Case Sheet1.Range("B16").Value
Case 1
Sheet1.Range("B83").Value = 3
Case 2
Sheet1.Range("B83").Value = 2
Case 3
Sheet1.Range("B83").Value = 1
Case 4
Sheet1.Range("B83").Value = 0
Case Else
Sheet1.Range("B83").ClearContents
End Select
Range("B138").FormulaR1C1 = "=SUM(R[-66]C:R[-2]C)"
End Sub