Results 1 to 1 of 1

vba code correction

Threaded View

  1. #1
    Registered User
    Join Date
    03-07-2014
    Location
    london
    MS-Off Ver
    Excel 2016
    Posts
    83

    vba code correction

    HI I added one column into the spreadsheet

    and im not sure how to correct it attached. thanks in advance

    the data should be displayed in columns in sheet 2 (NEW_SITES_RENOVATIONS_TABLE)

    
    Sub NEW_SITES_RENOVATIONS_TABLE()
    Dim Ray As Variant, n As Long, Ac As Long, c As Long
    Ray = Sheets("NEW_SITES_RENOVATIONS").Range("A1").CurrentRegion.Resize(, 17)
    ReDim nray(1 To UBound(Ray, 1) * UBound(Ray, 2) + 1, 1 To 6)
    c = 1
     nray(c, 1) = Ray(1, 1)
     nray(c, 2) = Ray(1, 2)
     'nray(c, 3) = Ray(1, 3)
     nray(c, 3) = Ray(1, 3)
     nray(c, 4) = "Date"
     nray(c, 5) = "Amount"
    
    For n = 2 To UBound(Ray, 1)
         For Ac = 5 To UBound(Ray, 2)
            c = c + 1
            nray(c, 1) = Ray(n, 1)
            nray(c, 2) = Ray(n, 2)
            'nray(c, 3) = Format(Ray(n, 3), "mmm_yy")
            nray(c, 3) = Ray(n, 3)
            If IsDate(Ray(1, Ac)) Then
                    nray(c, 4) = CDate(Ray(1, Ac))
            Else
                    nray(c, 4) = Ray(1, Ac)
            End If
            nray(c, 5) = Format(Ray(n, Ac), "#,##0.00000")
        Next Ac
    Next n
    Sheets("NEW_SITES_RENOVATIONS_TABLE").Cells.ClearContents
    Sheets("NEW_SITES_RENOVATIONS_TABLE").Range("A1").Resize(c, 5) = nray
    End Sub
    Attached Files Attached Files
    Last edited by antonio32; 08-26-2017 at 08:42 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Code correction
    By Indi_Ra in forum Excel General
    Replies: 0
    Last Post: 03-09-2016, 01:10 PM
  2. [SOLVED] Correction in code
    By Mart Marti in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2016, 01:30 PM
  3. [SOLVED] need correction in code
    By ccsmith in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2012, 06:14 AM
  4. Vba Code Correction
    By tromao in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2007, 05:55 PM
  5. [SOLVED] VBA Code Correction
    By RichIT in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-10-2006, 12:10 PM
  6. VBA Code Correction
    By RichIT in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2006, 11:35 AM
  7. Code Correction Need
    By Safi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-30-2006, 01:10 PM

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