Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello Admanirv, This code does what you want. It starts at "B2" looking for a 1 in tha column. If a I is present it will build the days worked string a outlined. The string will then be stored starting at "F2", then "G2" etc. Code ------------------- Public Sub FindOpDays() Dim N, D Dim I As Long Dim LastRow As Long Dim FirstDay As Integer LastRow = Range(\"A65536\").End(xlUp).Row For I = 2 To LastRow N = Cells(I, \"B\").Value D = Cells(I, \"A\").Value If N = 1 Then If FirstDay = 0 Then FirstDay = D Else If FirstDay < 0 Then Cells(2, \"D\").Offset(0, I).Value = Trim(Str(FirstDay)) &\" - \" & Trim(Str(D)) FirstDay = 0 End If End If Next I End Su ------------------- Sincerely, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=37411 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find data in two ranges | Excel Worksheet Functions | |||
lookup ranges to find commision | Excel Worksheet Functions | |||
Find Common names in multi ranges | Excel Worksheet Functions | |||
How do I find all named ranges in VB.NET? | Excel Discussion (Misc queries) | |||
How to find ranges in a sheet | Excel Programming |