View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_5_] Bob Phillips[_5_] is offline
external usenet poster
 
Posts: 620
Default Macros to compute Sales figures Differences between Months

rowNum = Range("A1").End(xlDown).Row
Range("B2").Formula = "=B" & rowNum & "-B" & rowNum - 1

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"slc" wrote in message
...
Thanks Bob.

One further questions. If I want to use row number instead how should
I do it. I have the following macro statement and the 3rd statement is
incorrect.

Range("A1").Select
Selection.End(xlDown).Select
RowNum = Row()
Range("B2").Formula = "=B" & RowNum & "-B" & RowNum - 1

Basically, the same thing i.e. I first go to cell A1, then goto the
last cell. get the row number of the last cell and then put the diff
b/w last cell and 2nd last cell in B1 cell.


Thanks once again.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/