ANTONIO1981
Board Regular
- Joined
- Apr 21, 2014
- Messages
- 162
HI I added an extra column into the spreadsheet (column D)
the code was working well without that column.
im not sure how to correct it attached.
New sites renovation table.xlsx - Google Drive
the data should be displayed in columns in sheet 2 (NEW_SITES_RENOVATIONS_TABLE
the code was working well without that column.
im not sure how to correct it attached.
New sites renovation table.xlsx - Google Drive
the data should be displayed in columns in sheet 2 (NEW_SITES_RENOVATIONS_TABLE
Code:
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