Import to array, export from array.
first part of my code... at the bolded msgbox, the data is unrounded, but in the cell it is rounded. Makes me think it is more an excel problem than VBA. The cells are formatted to accept up to 4 decimals, but it is always rounding to 2. can't figure out what is causing this rounding. none of the other inputs are being rounded, they don't normally have decimals (or more than 2 places) but I tested one and it correctly output the full decimal.
Thanks in advance, I really appreciate it.
first part of my code... at the bolded msgbox, the data is unrounded, but in the cell it is rounded. Makes me think it is more an excel problem than VBA. The cells are formatted to accept up to 4 decimals, but it is always rounding to 2. can't figure out what is causing this rounding. none of the other inputs are being rounded, they don't normally have decimals (or more than 2 places) but I tested one and it correctly output the full decimal.
Thanks in advance, I really appreciate it.
Code:
Option Base 1
Sub processdailystats()
Application.ScreenUpdating = False
Sheets("Stats").Select
Dim x As Integer
Dim DataArray(30, 6) As Variant
Range("a5").Select
Dim numberofdays As Integer
numberofdays = 0
'count rows
For x = 1 To 365
If ActiveCell.Value = "" Then
x = 365
ActiveCell.Offset(-1, 0).Select
Else
numberofdays = numberofdays + 1
ActiveCell.Offset(1, 0).Select
End If
Next x
Dim numberzero As Integer
numberzero = 0
'adds one row of data to the array
Dim ActualDays As Integer
ActualDays = 0
Dim DAY As Integer
For DAY = 1 To 30
If ActiveCell.Value = "" Then DAY = 30
ActualDays = ActualDays + 1
'date
x = 1
DataArray(DAY, x) = ActiveCell.Value
'DAU
ActiveCell.Offset(0, 8).Select
x = 2
DataArray(DAY, x) = ActiveCell.Value
'sessions
ActiveCell.Offset(0, 1).Select
x = 3
DataArray(DAY, x) = ActiveCell.Value
'new users
ActiveCell.Offset(0, 1).Select
x = 4
DataArray(DAY, x) = ActiveCell.Value
'rank1
ActiveCell.Offset(0, 10).Select
x = 5
DataArray(DAY, x) = ActiveCell.Value
'ARPDAU
ActiveCell.Offset(0, 2).Select
x = 6
If ActiveCell.Value = "-" Then DataArray(DAY, x) = numberzero Else DataArray(DAY, x) = ActiveCell.Value
ActiveCell.Offset(-1, -22).Select
Next DAY
'switch sheets in preparation to export data
Sheets("Daily Stats Review").Select
Range("b18").Select
'export time
For DAY = 1 To 7
'Date
ActiveCell.Value = DataArray(DAY, 1)
ActiveCell.Offset(0, 1).Select
'DAU
ActiveCell.Value = DataArray(DAY, 2)
ActiveCell.Offset(0, 1).Select
'sessions
ActiveCell.Value = DataArray(DAY, 3)
ActiveCell.Offset(0, 1).Select
'new users
ActiveCell.Value = DataArray(DAY, 4)
ActiveCell.Offset(0, 1).Select
'ARPDAU
[B]
MsgBox ("ARPDAU: " & DataArray(DAY, 6))
[/B]
ActiveCell.Value = DataArray(DAY, 6)
ActiveCell.Offset(0, 1).Select
'Average rank
ActiveCell.Value = DataArray(DAY, 5)
ActiveCell.Offset(-1, -5).Select
Next DAY
Last edited: