Cells(#,#).Value conversion

  • Thread starter Thread starter Norman Jones
  • Start date Start date
N

Norman Jones

Hi Alexandre,

In addition to Bob's suggestion, change:
startDate = ActiveRow.Cells(1, 2).Value
endDate = ActiveRow.Cells(1, 3).Value

to

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


---
Regards,
Norman



"Alexandre Brisebois (www.pointnetsolutions.com)"
 
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
 
Hi Alexandre,

And, in VBA. change the dimming from Integer to Long,
 
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 ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top