Results 1 to 3 of 3

Upper and lower case in VBA

Threaded View

  1. #1
    Registered User
    Join Date
    02-26-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    40

    Upper and lower case in VBA

    It seems that upper and lower case matters when working with VBA. Is there a way to make it where it doesn't matter? That way I wouldn't have to have so many potential options for my block if statements. See some of my partial code below.

    Function Total_Cost(Price, Landed_Cost, Channel, SBU)
    
    'Reference for cost data - only have to change reference here for worksheet
    Dim wks As Worksheet
    Set wks = Workbooks("VBA File.xlsm").Worksheets("Cost_Assumptions")
    
    'Cost Assumption Categories
    Dim Rebates     'Rebates/Discounts/Co-op's
    Dim Returns     'Returns and Allowances
    Dim Freight     'Freight and Warehousing
    Dim Warranty    'Warranty Costs
    Dim Other       'Other Manufacturing Costs
    
    'First if determines channel
    If Channel = "Internet" Or Channel = "eTail" Or Channel = "etail" Or Channel = "ETAIL" Or Channel = "90" Or Channel = "e-tail" Or Channel = "E-Tail" Or Channel = "E-TAIL" Then
        
    'Second if determines SBU
        If SBU = "Faucets" Or SBU = "Facuets" Or SBU = "Facuet" Or SBU = "Faucet" Then
        
    'Then allocated costs determined based off of table in worksheet
            Rebates = wks.Range("e23").Value
            Returns = wks.Range("f23").Value
            Freight = wks.Range("g23").Value
            Warranty = wks.Range("h23").Value
            Other = wks.Range("i23").Value
                           
        ElseIf SBU = "Repair Parts" Or SBU = "REPAIR PARTS" Then
            Rebates = wks.Range("e24").Value
            Returns = wks.Range("f24").Value
            Freight = wks.Range("g24").Value
            Warranty = wks.Range("h24").Value
            Other = wks.Range("i24").Value
            
        ElseIf SBU = "Acrylics" Or SBU = "ACRYLICS" Or SBU = "acrylics" Then
            Rebates = wks.Range("e25").Value
            Returns = wks.Range("f25").Value
            Freight = wks.Range("g25").Value
            Warranty = wks.Range("h25").Value
            Other = wks.Range("i25").Value
    Last edited by Mick S; 03-21-2011 at 06:44 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1