Select Case - Squishy spot on forehead

TDPenke

New Member
Joined
Mar 4, 2017
Messages
2
After digging through umpteen references - I'm still trying to figure out what I'm doing wrong here. Per the comments in the code: I have a workbook where on one worksheet there is a named range - _FST with a drop down select for yes or no. Based on the answer I want to perform a SUM of 40 - named ranges. Any help greatly appreciated with virtual beer :)

Code:
Sub FST_CHECK()

'Routine checks Job Title of Field Service Personnel to determine how Timesheet overtime (1.5x)hours
'are calculated.  FST overtime is calculated >40 hours on a Monday through Saturday basis.
'FSE & Sr. FSE overtime is calculated on a Monday through Friday basis with all Saturday hours
'worked as overtime.


Dim FS_Title As String
Dim FS_OT As Integer


FS_Title = "Sheet1._FST.Value" 'Yes=FST / No=FSE or Sr. FSE




Select Case FS_Title


    Case Is = "Yes" 'If Title of FS Person is FST
        FS_OT = Sheet2.Range("_OT").Formula = (40 - Sum("_HW2,_HW3,_HW4,_HW5,_HW6,_HW7,_HV2,_HV3,_HV4,_HV5,_HV6,_HV7")) 'Sum of 40-work and travel hours M-St
        
    Case Is = "No"  'If Title of FS Person is FSE or Sr. FSE
        FS_OT = Sheet2.Range("_OT").Formula = (40 - Sum("_HW2,_HW3,_HW4,_HW5,_HW6,_HV2,_HV3,_HV4,_HV5,_HV6,"))  'Sum of 40-work and travel hours M-F
        
    Case Else
        FS_OT = Sheet2.Range("_OT").Value = 0
        
End Select
    
End Sub
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Try changing this
Code:
FS_Title = "Sheet1._FST.Value"
to
Code:
FS_Title = Sheet1.range("_FST").Value
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,592
Members
449,089
Latest member
Motoracer88

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