View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.newusers
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default VBA code and decimals

Sub test()
Dim lastrow As Long
Dim rrow As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
rrows = lastrow / 4
MsgBox rrows 'returns 34.5 if lastrow is 138
End Sub


Gord Dibben MS Excel MVP

On Sat, 30 Sep 2006 07:49:01 -0700, pcor wrote:

I have some VBA code as this:
rrows=lastrow/4

if lastrow is 138 then rrows should be 34.5 but I always get 34(no decimal)
How do I fix that
Thanks