Thanks for helping.



On Sun, May 8, 2011 at 6:31 AM, STDEV(i) <setiyowati.d...@gmail.com> wrote:

> Sub ExpandTable()
>    ' by siti Vi / jakarta, 8 may 2011
>    Dim SrcRng As Range, ResRng As Range, pDate As Date
>    Dim i As Long, r As Long, u As Integer
>
>    Set SrcRng = Cells(1).CurrentRegion
>    Worksheets.Add After:=Sheets(Sheets.Count)
>    Set ResRng = ActiveSheet.Cells(1)
>
>    For i = 1 To SrcRng.Rows.Count
>       If IsDate(SrcRng(i, 3)) And IsDate(SrcRng(i, 4)) _
>       Then pDate = IIf(SrcRng(i, 3) < SrcRng(i, 4), SrcRng(i, 4), SrcRng(i,
> 3))
>       If SrcRng(i, 2).Value - Int(SrcRng(i, 2).Value) > 0 Then
>          For u = 1 To 2
>             r = r + 1
>             ResRng(r, 1) = SrcRng(i, 1)
>             If u = 1 Then ResRng(r, 2) = Int(SrcRng(i, 2))
>             If u = 2 Then ResRng(r, 2) = SrcRng(i, 2) - Int(SrcRng(i, 2))
>             ResRng(r, 3) = IIf(pDate = 0, SrcRng(i, 3), pDate)
>             ResRng(r, 4) = IIf(pDate = 0, SrcRng(i, 4), pDate)
>          Next u
>       End If
>    Next i
>    ResRng.CurrentRegion.Offset(0, 2).Columns.AutoFit
> End Sub
>
>
> On Sat, May 7, 2011 at 1:03 PM, anvesh.gw...@gmail.com <
> anvesh.gw...@gmail.com> wrote:
>
>> Hi,
>>
>> I need help in VBA code.
>> I have excel sheet on which data is write as below mention
>>
>>
>> Input
>>
>>      A       B        C                         D
>> 1   X1      1.5    11/11/2008       01/11/2010
>> 2   X2      2.5    11/12/2009       01/11/2010
>> 3   X3      3.5    11/01/2010       01/11/2010
>>
>> I want Output in another sheet as given below
>>
>> Output
>>
>>    A       B        C                         D
>> 1   X1      1.0    11/11/2008       01/11/2010
>> 1   X1      0.5    11/11/2008       01/11/2010
>> 2   X2      2.0    11/12/2009       01/11/2010
>> 2   X2      0.5    11/12/2009       01/11/2010
>> 3   X3      3.0    11/01/2010       01/01/2010
>> 3   X3      0.5    11/01/2010       01/01/2010
>>
>>
>> Procedure
>> 1. Check column B if it contain decimal than separate integer and
>> decimal i.e if value is 1.5 than
>> insert row and split  as mention above in output
>> 2. Check C and D for date if "C" column Date is less than "D" Column
>> than pick Date of "D" column other wise pick date of  "C" Column.
>>
>> Can any body help me in this.
>>
>> Thanks in advance
>> Anvesh
>
>

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to