I am in need of a simple macro to find gaps in stock data. I've attached a dummy workbook with further detail. Would appreciate if anyone could help. Thanks
I am in need of a simple macro to find gaps in stock data. I've attached a dummy workbook with further detail. Would appreciate if anyone could help. Thanks
Last edited by Test123Test; 03-18-2012 at 01:39 AM.
see the result of the macro in column sV and W.
data in col S and T kept for checking. you can delete them
I am also sending back the file
the macro (already in the module of this file)
the data after running macro will be![]()
Sub test() Dim r As Range, c As Range Dim cclose As Double, oopen As Double, dest As Range Columns("V:w").Delete Set r = Range(Range("A5"), Range("A5").End(xlDown).Offset(-1, 0)) For Each c In r If c <> c.Offset(1, 0) Then cclose = Cells(c.Row, "F").Value oopen = Cells(c.Offset(1, 0).Row, "C").Value Set dest = Cells(Rows.Count, "V").End(xlUp).Offset(1, 0) dest = c.Offset(1, 0).Value dest.Offset(0, 1) = oopen - cclose End If Next c Range(Range("V2"), Range("V2").End(xlDown).Offset(0, 1)).Cut Range("V6") End Sub
I am not an expert. better solutions may be available
$$$$venkat1926$$$$@gmail.com
venkat1926, this code works perfect! thanks so much, repped and marked thread as solved
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks