+ Reply to Thread
Results 1 to 24 of 24

Expected: end of statement in Macro

Hybrid View

  1. #1
    Registered User
    Join Date
    10-16-2012
    Location
    tn
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Expected: end of statement in Macro

    Thanks for the quick reply Holger. I tried your suggestion, but it still didn't work. The formula for cells in column D would just display =BDP("C","CALLED_DT"). I need it to actually reference what is in column C and use that in the formula. I revised the code a little and here's what I have now. I'm having the same problem though. Formula in column D is displaying as =BDP("rng3.Value","CALLED_DT").

    Sub Backup()
    '
    ' Backup Macro
    ' backup of call cusips formatting
    
     For Each ws In Sheets
        ws.Activate
        Dim A As Long, B As Long
        A = Range("B" & Rows.Count).End(xlUp).Row
        For B = A To 1 Step -1
        
        Set rng1 = Range("A" & B)
        Set rng2 = Range("B" & B)
        Set rng3 = Range("C" & B)
        Set rng4 = Range("D" & B)
        Set rng5 = Range("E" & B)
        Set rng6 = Range("F" & B)
        
        'Define Security Type so BB can read
        If rng2.Value Like "AGY*" Then rng3.Value = rng1.Value & " Corp"
        If rng2.Value Like "CD*" Then rng3.Value = rng1.Value & " Corp"
        If rng2.Value Like "CORP*" Then rng3.Value = rng1.Value & " Corp"
        If rng2.Value Like "MUNI*" Then rng3.Value = rng1.Value & " Muni"
        If rng2.Value Like "PREF*" Then rng3.Value = rng1.Value & " Pfd"
        If rng2.Value Like "PRST*" Then rng3.Value = rng1.Value & " Pfd"
        If rng2.Value Like "FOREIGN*" Then rng3.Value = rng1.Value & " Corp"
        
        'Look up BB Data Points
        If rng3.Value Like "*Corp" Then rng4.Formula = "=BDP(""rng3.Value"", ""CALLED_DT"")"
            If rng3.Value Like "*Corp" Then rng5.Formula = "=BDP(""rng3.Value"", ""CALLED_PX"")"
                If rng3.Value Like "*Corp" Then rng6.Formula = "=BDP(""rng3.Value"", ""MOST_RECENT_REPORTED_FACTOR"")"
        If rng3.Value Like "*Muni" Then rng4.Formula = "=BDP(""rng3.Value"", ""MUNI_RECENT_REDEMP_DT"")"
            If rng3.Value Like "*Muni" Then rng5.Formula = "=BDP(""rng3.Value"", ""MUNI_RECENT_REDEMP_PX"")"
                If rng3.Value Like "*Muni" Then rng6.Formula = "=BDP(""rng3.Value"", ""MUNI_RECENT_REDEMP_TYP"")"
        If rng3.Value Like "*Pfd" Then rng4.Formula = "=BDP(""rng3.Value"", ""CALLED_DT"")"
            If rng3.Value Like "*Pfd" Then rng5.Formula = "=BDP(""rng3.Value"", ""CALLED_PX"")"
           
        Next B
        Next ws
        Application.ScreenUpdating = True
        Application.DisplayStatusBar = True
    
    End Sub

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,199

    Re: Expected: end of statement in Macro

    Hi, reltub,

    I must excuse - it was way to early this morning to answer.

    "=BDP(" & Range("C" & B).Value & ", ""CALLED_DT"")"
    for the Value of the cell and
    "=BDP(" & Range("C" & B).Address & ", ""CALLED_DT"")"
    for the address with absolute reference.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ Reply to Thread

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