Results 1 to 12 of 12

Problem with cell reference in my code. Need another pair of eyes!

Threaded View

  1. #1
    Registered User
    Join Date
    12-11-2012
    Location
    Seattle
    MS-Off Ver
    Excel 2007
    Posts
    51

    Problem with cell reference in my code. Need another pair of eyes!

    Hello everyone,

    Attached is the result. Below is the section of my code the creates the result.



    1) I need the date in column C to appear in column P for each instance of "FIRST AIRDATE" in column B.
    a. date does not start in P4
    b. dates do not format to dd/mm/yyyy for every cell. see orange
    c. show zero if no date. see pink

    My cell references look correct but I cannot figure out why the formatting is not working and as for the date "00/00/1900" I've tried several formulas and cannot get them to work to zero out that type of date. So here I'm looking for a suggestion as to what to try next.
    'concatenate
    
        Range("M2").Select
        Do Until IsEmpty(ActiveCell.Offset(0, -11))
        ActiveCell.FormulaR1C1 = _
        "=IF(RC[-11]=""COMPANY :"",(RC[-10] & "" + "" & TEXT(R[2]C[-10],""dd/mm/yyyy"") & "": "" & R[3]C[-10]),R[-1]C)"
        ActiveCell.Offset(1, 0).Select
        Loop
    
    Columns("M:M").Select
        Selection.Copy
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
            
    'move company details to rows
    
        Range("N2").Select
        Do Until IsEmpty(ActiveCell.Offset(0, -13))
        ActiveCell.FormulaR1C1 = _
        "=IF(RC[-12]=""COMPANY :"",RC[-11],R[-1]C)"
        ActiveCell.Offset(1, 0).Select
        Loop
        Range("O2").Select
        Do Until IsEmpty(ActiveCell.Offset(0, -14))
        ActiveCell.FormulaR1C1 = _
        "=IF(RC[-13]=""SHOW TITLE :"",RC[-12],R[-1]C)"
        ActiveCell.Offset(1, 0).Select
        Loop
        Range("P2").Select
        Do Until IsEmpty(ActiveCell.Offset(0, -15))
        ActiveCell.FormulaR1C1 = _
        "=IF(RC[-14]=""FIRST AIRDATE :"",RC[-13],TEXT(R[-1]C,""dd/mm/yyy""))"
        ActiveCell.Offset(1, 0).Select
        Loop
    
    Columns("N:P").Select
        Selection.Copy
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Range("Q2").Select
        Do Until IsEmpty(ActiveCell.Offset(0, -1))
        ActiveCell.FormulaR1C1 = _
        "=Concatenate(RC[-3],"" + "",RC[-2],"": "",RC[-1])"
        ActiveCell.Offset(1, 0).Select
        Loop
        
        'create headers for review
        Range("A1").Select
        Selection.EntireRow.Insert
        ActiveCell.FormulaR1C1 = "SourceFile"
        Range("M1").Select
        ActiveCell.FormulaR1C1 = "Company_upload"
        Range("N1").Select
        ActiveCell.FormulaR1C1 = "COMPANY :"
        Range("O1").Select
        ActiveCell.FormulaR1C1 = "SHOW TITLE :"
        Range("P1").Select
        ActiveCell.FormulaR1C1 = "FIRST AIRDATE :"
        Range("Q1").Select
        ActiveCell.FormulaR1C1 = "ConcatenateFormula"
        Range("A1").Select
        
        Columns("M:Q").EntireColumn.AutoFit
            
    ExitTheSub:
        ' Restore the application properties.
        With Application
            .ScreenUpdating = True
            .EnableEvents = True
            .Calculation = CalcMode
        End With
        ChDirNet SaveDriveDir
    Attached Files Attached Files
    Last edited by Leith Ross; 05-09-2014 at 03:41 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Cant see why this code is doing what it is doing - need expert eyes
    By winwall in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2014, 05:41 PM
  2. [SOLVED] Non-excel VB-related code for detailed eyes to examine and solve
    By mellowmarshall in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-19-2013, 06:02 PM
  3. [SOLVED] Having a problem with VLOOKUP and need an extra pair of eyes.
    By poisontoast in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-16-2012, 06:28 AM
  4. Help create code to pair like items at random
    By SAFD1450 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-30-2011, 01:03 PM
  5. Need code to pair off numbers
    By davidm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-16-2006, 02:50 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