Results 1 to 5 of 5

Thread: Cell Split or add Rows Excel VBA Leave Plan

  1. #1

    Cell Split or add Rows Excel VBA Leave Plan

    I am having leave plan which shows name in calendar depends on start date and end date
    looks like this

    cal3.jpg

    using this function

    VB:
    Function vac(dt As Date, rngnme As Range, rngstrt As Range, rngend As Range) As String Application.Volatile
    Dim i&
    Dim temp As String
    temp = ""


    For i = 1 To rngnme.Rows.Count
    If rngnme.Cells(i, 1) <> "" Then
    If rngstrt.Cells(i, 1) <= dt And rngend.Cells(i, 1) >= dt Then
    temp = temp & rngnme.Cells(i, 1) & ","
    End If
    End If
    Next i


    If temp = "" Then
    vac = CVErr(xlErrNA)
    ElseIf Len(temp) - Len(Replace(temp, ",", "")) > 4 Then
    vac = "> 4"
    Else
    vac = Left(temp, Len(temp) - 1)
    End If
    If temp = "" Then
    vac = CVErr(xlErrNA)
    ElseIf Len(temp) - Len(Replace(temp, ",", "")) = 0 Then
    vac = "= 0"
    Else
    vac = Left(temp, Len(temp) - 1)
    End If
    End Function

    and formula is

    =IFERROR(vac(DATE($D$1,ROWS($A$3:$A3),B$2),$A$60:$A$100,$B$60:$B$100,$C$60: $C$100),"")

    I want to add rows if more than one name is in cell i want it to be look like something like this attached image below

    cal new.jpg

    What can be the possible solution please help

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,970

  3. #3
    Yes I did post that on both forums so that i can increase the viewership to get help

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,970
    have a read of http://www.excelguru.ca/content.php?184,
    perhaps the rules too.

  5. #5
    VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,709
    Location
    @ P45cal,
    I'll just wait another day with my solution to see how the OP responds to you.
    Please take the time to read the Forum FAQ

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •