Cells(#,#).Value conversion

  • Thread starter Thread starter Norman Jones
  • Start date Start date
Hey I want to grab a serialized date and turn it into an integer in my
vba
what is the proper conversion for this ?

exampel:

Dim startDate As Integer
Dim endDate As Integer

startDate = ActiveRow.Cells(1, 2).Value
endDate = ActiveRow.Cells(1, 3).Value
 
problem is well here is my full script

Sub WritePoints(ByRef RawPoints As Range)
Dim objSheet As Worksheet
Set objSheet = ActiveSheet
Dim ActiveRowOffset As Integer

ActiveRowOffset = 1

objSheet.Cells(1, 1).Value = "Task description"
objSheet.Cells(1, 2).Value = "Date completion schedule"

Dim ActiveRow As Range
Dim startDate As Integer
Dim endDate As Integer
Dim task As String

For Each ActiveRow In RawPoints.Rows
tast = ActiveRow.Cells(1, 1).Value2

startDate = CInt(ActiveRow.Cells(1, 2).Value)
endDate = CInt(ActiveRow.Cells(1, 3).Value)

If (startDate = endDate) Then

Debug.Print ActiveRow.Cells(1, 1).Value
objSheet.Cells(1, 1).Activate
ActiveCell.Offset(ActiveRow, 1).Value = task
ActiveRowOffset = 1 + ActiveRowOffset

End If



Next ActiveRow

End Sub
 
I now get overflows, but i really need my values as ints i need to
trucate the decimals...
 
I have use Clng() but now the problem is that it rounds uo or down i
simply want to trucate the last digits after the decimal...

any thoughts ?
 
Back
Top