+ Reply to Thread
Results 1 to 4 of 4

Required macro to break the time and insert a new worksheet

Hybrid View

  1. #1
    Forum Contributor PRADEEPB270's Avatar
    Join Date
    02-19-2010
    Location
    INDIA
    MS-Off Ver
    MSoffice-2016
    Posts
    332

    Required macro to break the time and insert a new worksheet

    Please refer my attach file for more clarification.

    I want a Macro working who insert the 2 new sheets.

    1-Insert One new sheet,only keep all the rows having time 00:00:00 to 12:00:00,appearing in column-'K'. in the attach file.
    2-Insert other new sheet,only keep all the rows having time 12:00:01 to 24:00:00,appearing in column-K'in the attach file.

    Can it be possible through VBA codes working?
    Regards


    Pradeep Kumar Gupta
    Gurgaon ( INDIA )

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Required macro to break the time and insert a new worksheet

    Try this...

    Sub CreateSheets()
    Dim rMyRng As Range
    
    Set rMyRng = Range("$B$2").CurrentRegion
    
    With rMyRng
        For i = 1 To 2
            If i = 1 Then .AutoFilter 10, ">=00:00:00", xlAnd, "<=12:00:00"
            If i = 2 Then .AutoFilter 10, ">12:00:00", xlAnd, "<=24:00:00"
            Sheets.Add
            .SpecialCells(xlCellTypeVisible).Rows.Copy Range("A1")
            Range("A1").CurrentRegion.EntireColumn.AutoFit
        Next i
       .AutoFilter
    End With
       
    End Sub


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Forum Contributor PRADEEPB270's Avatar
    Join Date
    02-19-2010
    Location
    INDIA
    MS-Off Ver
    MSoffice-2016
    Posts
    332

    Re: Required macro to break the time and insert a new worksheet

    Thanks a lot.Codes are working fine with no problem at all.Glad to find it.

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Required macro to break the time and insert a new worksheet

    Glad it helps you and thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. macro to insert page break when value in row changes
    By printroom in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-19-2013, 06:15 AM
  2. Insert blank row, sum and insert page break macro
    By kim5012 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-06-2012, 01:46 AM
  3. Create insert page break macro
    By qtam82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-11-2012, 03:57 AM
  4. Code Required To Avoid Error on Worksheet Insert
    By GDUBBS780 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-06-2012, 04:04 PM
  5. Replies: 3
    Last Post: 08-12-2009, 04:05 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1