N3K
07-24-2006, 08:41 PM
Sub SumLastTwo()
Lastrow = Range("A27").End(xlUp).Value
Lastrow2 = (Range("A27").End(xlUp).Row) - 1
Sum = Lastrow + Lastrow2
Range("B27").Value = Sum
End Sub
i don't know whether this has been asked before and solved or not but i don't have time to search one by one. I don't how to search for it also as i am very new to VBA.
i would like to sum the last two entries but i don't know how to get entry value for Lastrow2. Currently Lastrow2 return its address value. For example, i put value 10 in A26 and 15 in A25, i will get 10+25 = 35 instead of 10+15 = 25 and how to print the sum to the same row (row A27 -> B27)
Lastrow = Range("A27").End(xlUp).Value
Lastrow2 = (Range("A27").End(xlUp).Row) - 1
Sum = Lastrow + Lastrow2
Range("B27").Value = Sum
End Sub
i don't know whether this has been asked before and solved or not but i don't have time to search one by one. I don't how to search for it also as i am very new to VBA.
i would like to sum the last two entries but i don't know how to get entry value for Lastrow2. Currently Lastrow2 return its address value. For example, i put value 10 in A26 and 15 in A25, i will get 10+25 = 35 instead of 10+15 = 25 and how to print the sum to the same row (row A27 -> B27)