+ Reply to Thread
Results 1 to 4 of 4

How to Split VBA code in New lines

Hybrid View

naveenmarapaka How to Split VBA code in New... 01-07-2014, 10:39 AM
Andy Pope Re: How to Split VBA code in... 01-07-2014, 10:56 AM
ianxwood Re: How to Split VBA code in... 01-07-2014, 11:05 AM
naveenmarapaka Re: How to Split VBA code in... 01-08-2014, 02:19 AM
  1. #1
    Forum Contributor
    Join Date
    09-05-2012
    Location
    Dubai
    MS-Off Ver
    Office 365
    Posts
    409

    How to Split VBA code in New lines

    Hi all,
    i am finding difficulty to split the VBA code to new lines.
    getting error always as i tried many ways with _ , VBLF etc

    pls help to solve it

     .FormulaR1C1 = "=IF(OR(RC[4]=497,RC[4]=10403),""UAE COURT PROJECT"",IF(RC[4]=825,""SHJ MUNICIPALITY"",IF(OR(RC[14]=""Kalyan"",RC[14]=""Kandaj"",RC[14]=""loreleen"",RC[14]=""nabeeh"",RC[14]=""AbelAP"",RC[14]=""Kalyana Chinnak"",RC[14]=""Fathelrahman"",RC[14]=""John Bosco"",RC[14]=""Nilantha Jayaso"",RC[14]=""Nilantha"",RC[14]=""Abel Apostol"",RC[14]=""SunilR"",RC[14]=""kumarapelie"",RC[14]=""AhmedEla"",RC[14]=""HafizAl"",RC[14]=""Abdulbasit"",RC[14]=""Younus"",RC[14]=""MouradC""),""SHJ"",IF(OR(RC[14]=""sadanandan"",RC[14]=""Sadanandan Nedu"",RC[14]=""Jayaprakash"",RC[14]=""ImranI"",RC[14]=""Imran"",RC[14]=""johnb"",RC[14]=""Faroz""),""AQZ"",IF(OR(RC[14]=""Ermin"",RC[14]=""Amina""),""DIC"",IF(OR(RC[14]=""Imrank"",RC[14]=""Rashidmahmood"",RC[14]=""buhari"",RC[14]=""HusamA"",RC[14]=""Hajam"",RC[14]=""AMashrafK"",RC[14]=""rashidmahmoodM"",RC[14]=""Atif"",RC[14]=""Bazlulhuk""),""AAN"",IF(OR(RC[14]=""AwliyaA"",RC[14]=""jabarullah"",RC[14]=""Nasr Ahmed"",RC[14]=""ZainabS""),""RKT"",""DXB"")))))))"

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: How to Split VBA code in New lines

            .FormulaR1C1 = "=IF(OR(RC[4]=497,RC[4]=10403),""UAE COURT PROJECT""," & _
                           "IF(RC[4]=825,""SHJ MUNICIPALITY"",IF(OR(RC[14]=""Kalyan"",RC[14]=""Kandaj""," & _
                           "RC[14]=""loreleen"",RC[14]=""nabeeh"",RC[14]=""AbelAP"",RC[14]=""Kalyana Chinnak""," & _
                           "RC[14]=""Fathelrahman"",RC[14]=""John Bosco"",RC[14]=""Nilantha Jayaso""," & _
                           "RC[14]=""Nilantha"",RC[14]=""Abel Apostol"",RC[14]=""SunilR"",RC[14]=""kumarapelie""," & _
                           "RC[14]=""AhmedEla"",RC[14]=""HafizAl"",RC[14]=""Abdulbasit"",RC[14]=""Younus""," & _
                           "RC[14]=""MouradC""),""SHJ"",IF(OR(RC[14]=""sadanandan"",RC[14]=""Sadanandan Nedu""," & _
                           "RC[14]=""Jayaprakash"",RC[14]=""ImranI"",RC[14]=""Imran"",RC[14]=""johnb"",RC[14]=""Faroz"")," & _
                           """AQZ"",IF(OR(RC[14]=""Ermin"",RC[14]=""Amina""),""DIC"",IF(OR(RC[14]=""Imrank""," & _
                           "RC[14]=""Rashidmahmood"",RC[14]=""buhari"",RC[14]=""HusamA"",RC[14]=""Hajam""," & _
                           "RC[14]=""AMashrafK"",RC[14]=""rashidmahmoodM"",RC[14]=""Atif"",RC[14]=""Bazlulhuk"")," & _
                           """AAN"",IF(OR(RC[14]=""AwliyaA"",RC[14]=""jabarullah"",RC[14]=""Nasr Ahmed""," & _
                           "RC[14]=""ZainabS""),""RKT"",""DXB"")))))))"
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    12-07-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: How to Split VBA code in New lines

    Hi

    Since the total formula is 1 string you`ll need to close it at each line break and then concatenate and reopen the string on the next line E.G.

    
             .FormulaR1C1 = "=IF(OR(RC[4]=497,RC[4]=10403),""UAE COURT PROJECT"", " & _
            "IF(RC[4]=825,""SHJ MUNICIPALITY"",IF(OR(RC[14]=""Kalyan"",RC[14]=""Kandaj"", " & _
            "RC[14]=""loreleen"",RC[14]=""nabeeh"",RC[14]=""AbelAP"",RC[14]=""Kalyana Chinnak"", " & _
            "RC[14]=""Fathelrahman"",RC[14]=""John Bosco"",RC[14]=""Nilantha Jayaso"",RC[14]=""Nilantha"", " & _
            "RC[14]=""Abel Apostol"",RC[14]=""SunilR"",RC[14]=""kumarapelie"",RC[14]=""AhmedEla"",RC[14]=""HafizAl"", " & _
            "RC[14]=""Abdulbasit"",RC[14]=""Younus"",RC[14]=""MouradC""),""SHJ"",IF(OR(RC[14]=""sadanandan"", " & _
            "RC[14]=""Sadanandan Nedu"",RC[14]=""Jayaprakash"",RC[14]=""ImranI"",RC[14]=""Imran"",RC[14]=""johnb"", " & _
            "RC[14]=""Faroz""),""AQZ"",IF(OR(RC[14]=""Ermin"",RC[14]=""Amina""),""DIC"",IF(OR(RC[14]=""Imrank"", " & _
            "RC[14]=""Rashidmahmood"",RC[14]=""buhari"",RC[14]=""HusamA"",RC[14]=""Hajam"",RC[14]=""AMashrafK"", " & _
            "RC[14]=""rashidmahmoodM"",RC[14]=""Atif"",RC[14]=""Bazlulhuk""),""AAN"",IF(OR(RC[14]=""AwliyaA"", " & _
            "RC[14]=""jabarullah"",RC[14]=""Nasr Ahmed"",RC[14]=""ZainabS""),""RKT"",""DXB"")))))))"
    Regards
    Ian

  4. #4
    Forum Contributor
    Join Date
    09-05-2012
    Location
    Dubai
    MS-Off Ver
    Office 365
    Posts
    409

    Re: How to Split VBA code in New lines

    Thanks a million , Its perfectly working.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to split the lines in a cell into multiple rows.
    By narayana_ou@yah in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-23-2014, 04:19 AM
  2. [SOLVED] Excel 2007 : Split formula in 2 lines in 1 cell
    By Raen in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-17-2013, 06:21 AM
  3. Importing from access and need to split lines
    By SallyB in forum Excel General
    Replies: 1
    Last Post: 03-11-2013, 02:26 AM
  4. how to convert excel split code to word split code
    By gsrikanth in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2012, 07:56 AM
  5. Split excel file into multiple files by lines
    By roger212 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-18-2011, 04:46 AM

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