ANTONIO1981
Board Regular
- Joined
- Apr 21, 2014
- Messages
- 162
Hi
the final result shown in column "Amount" is ignoring any decimals that i populated in Sheet("ENGINEERS_REG_MGRS"),
hence if i sum the column will give wrong data
thanks in advance
the final result shown in column "Amount" is ignoring any decimals that i populated in Sheet("ENGINEERS_REG_MGRS"),
hence if i sum the column will give wrong data
thanks in advance
Code:
Sub ENGINEERS_REG_MGRS_TABLE()
Dim Ray As Variant, n As Long, Ac As Long, c As Long
Ray = Sheets("ENGINEERS_REG_MGRS").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, 4) = Ray(1, 4)
nray(c, 5) = "Date"
nray(c, 6) = "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, 4) = Ray(n, 4)
If IsDate(Ray(1, Ac)) Then
nray(c, 5) = CDate(Ray(1, Ac))
Else
nray(c, 5) = Ray(1, Ac)
End If
nray(c, 6) = Format(Ray(n, Ac), "#,##0")
Next Ac
Next n
Sheets("ENGINEERS_REG_MGRS_TABLE").Range("A1").Resize(c, 6) = nray
End Sub
Last edited: