+ Reply to Thread
Results 1 to 6 of 6

Selected time copying

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-31-2011
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    191

    Selected time copying

    Hello Gurus,

    I need your help again,

    On my Attached File, I have a Data Sheet and I want only to copy the value of the Humidity & Temperature base on the value of time ending in :02 Like ( 9/13/2018 12:02:00 AM ; 9/13/2018 1:02:00 AM ; 9/13/2018 2:02:00 AM....) on the other sheet from September 13 up to Sept 20.

    The format will be like in the "Format Sheet" of the attached file.

    cross posted: https://www.excelguru.ca/forums/show...d-time-copying

    Thank you
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Selected time copying

    see attached file [sheet1]

    Here's the formula used in A2 and then dragged across to column E and down to row 250.

    HTML Code: 
    Hope this helps.
    Attached Files Attached Files
    1. Click on the * Add Reputation if you think this helped you
    2. Mark your thread as SOLVED when question is resolved

    Modytrane

  3. #3
    Forum Contributor
    Join Date
    01-31-2011
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    191

    Re: Selected time copying

    Hi Modytrane,

    Thank you for the code. I really appreciate it.

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Selected time copying

    Sub Main()
      Dim calc As Integer
      Dim lr As Long, ws1 As Worksheet, ws2 As Worksheet
      Dim r As Range
      
      'On Error GoTo EndNow
      With Application
        calc = .Calculation
        .Calculation = xlCalculationManual
        .EnableEvents = False
        .ScreenUpdating = False
      End With
      
      Set ws1 = Worksheets("Data")
      Set ws2 = Worksheets.Add(After:=Worksheets(Worksheets.Count))
      
      'Filter ws1 by 02 minutes
      With ws1
        'Make filter field
        lr = .Cells(Rows.Count, "A").End(xlUp).Row
        .[F1] = "2m?"
        .[F2].Formula = "=Find("":02:"",Text(A2,""hh:mm:ss""))=3"
        .[F2].Copy .Range("F2", .Cells(lr, "F"))
        'Filter by created field
        .UsedRange.AutoFilter Field:=6, Criteria1:="TRUE"
        Set r = Intersect(.Columns("A:E"), .UsedRange.SpecialCells(xlCellTypeVisible))
        'Copy and paste filtered data
        r.Copy
        ws2.[A1].PasteSpecial xlPasteColumnWidths
        r.Copy ws2.[A1]
        'Remove filter column F
        Intersect(.Columns("F:F"), .UsedRange).Clear
        'Remove autofilter
        .[A1].AutoFilter
        [A1].Select
      End With
      
      
    EndNow:
      With Application
        .Calculation = calc
        .EnableEvents = True
        .ScreenUpdating = True
        .CutCopyMode = False
      End With
    End Sub

  5. #5
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Selected time copying

    Hi @thong127

    With this data, you can use a much simpler formula

    Try this and copy forward and down
    Formula: copy to clipboard
    =INDEX(A$2:A$2305,12*ROW($A1)-11)

  6. #6
    Forum Contributor
    Join Date
    01-31-2011
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    191

    Re: Selected time copying

    Thank you All.

+ 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. Copying selected time
    By thong127 in forum Excel General
    Replies: 3
    Last Post: 08-30-2018, 06:06 PM
  2. Need Help with an user form that convert GTM Time to Other selected Time Zone
    By odoualex in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-08-2014, 11:52 AM
  3. VB for copying a selected range
    By John McCann in forum Excel General
    Replies: 1
    Last Post: 12-01-2011, 01:03 PM
  4. Copying selected records
    By RobertWA in forum Excel General
    Replies: 2
    Last Post: 11-06-2010, 12:07 AM
  5. copying selected text from one column to another
    By annie79 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-22-2007, 05:42 AM
  6. Help with copying selected row to new sheet
    By ATOMICLUIS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2005, 06:45 PM
  7. Copying selected rows to another sheet
    By tacarme in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 09-06-2005, 12:05 PM

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