+ Reply to Thread
Results 1 to 21 of 21

transfer data from the main workbook to another sheet Based on the date of retirement age

Hybrid View

Feisty2 transfer data from the main... 02-24-2018, 11:31 PM
alansidman Re: transfer data from the... 02-24-2018, 11:33 PM
Feisty2 Re: transfer data from the... 02-25-2018, 09:58 AM
Feisty2 Re: transfer data from the... 02-25-2018, 12:07 PM
Feisty2 Re: transfer data from the... 02-25-2018, 06:48 PM
Feisty2 Re: transfer data from the... 02-25-2018, 08:11 PM
Feisty2 Re: transfer data from the... 02-26-2018, 08:28 AM
jindon Re: transfer data from the... 02-26-2018, 09:22 AM
Feisty2 Re: transfer data from the... 02-26-2018, 02:09 PM
jindon Re: transfer data from the... 02-26-2018, 09:49 PM
Feisty2 Re: transfer data from the... 02-28-2018, 02:10 PM
jindon Re: transfer data from the... 02-28-2018, 07:43 PM
Feisty2 Re: transfer data from the... 03-01-2018, 11:30 AM
jindon Re: transfer data from the... 03-01-2018, 10:25 PM
Feisty2 Re: transfer data from the... 03-02-2018, 04:46 PM
jindon Re: transfer data from the... 03-02-2018, 10:06 PM
Feisty2 Re: transfer data from the... 03-03-2018, 10:02 AM
jindon Re: transfer data from the... 03-04-2018, 02:25 AM
Feisty2 Re: transfer data from the... 03-04-2018, 03:05 AM
jindon Re: transfer data from the... 03-04-2018, 03:55 AM
Feisty2 Re: transfer data from the... 03-04-2018, 10:39 AM
  1. #1
    Registered User
    Join Date
    02-24-2018
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    97

    transfer data from the main workbook to another sheet Based on the date of retirement age

    Greetings,
    Appreciate any direction or code you might share.
    Thanks a lot for your help.
    Last edited by Feisty2; 03-14-2018 at 10:05 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,705

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    02-24-2018
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    97

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    I'm new here and do not know how I can upload a file
    Last edited by Feisty2; 03-04-2018 at 10:56 AM.

  4. #4
    Registered User
    Join Date
    02-24-2018
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    97

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    All help is much appreciated.

  5. #5
    Registered User
    Join Date
    02-24-2018
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    97

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    All help is much appreciated.

  6. #6
    Registered User
    Join Date
    02-24-2018
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    97

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    Any help in this topic please?

  7. #7
    Registered User
    Join Date
    02-24-2018
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    97

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    Can someone assist or can give some direction? Thank you

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    Merged cells....
    Sub test()
        Sheets("result").Cells.Delete
        With Sheets("main")
            .Rows("1:2").Copy Sheets("result").Cells(1)
            .[z2].Formula = "=and(c2>=eomonth(today(),1)+1-day(today()),c2<=eomonth(today(),1))"
            With .Range("a1", .Cells.SpecialCells(11))
                .Rows("1:2").Copy Sheets("result").Cells(1)
                .AdvancedFilter 1, .Parent.[z1:z2]
                .Offset(2).Copy Sheets("result").[a3]
            End With
            If .FilterMode Then .ShowAllData
            .[z2].Clear
        End With
        With Sheets("result")
            .[z2].Clear: .Columns.AutoFit
        End With
    End Sub

  9. #9
    Registered User
    Join Date
    02-24-2018
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    97

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    Thanks a lot Mr. jindon .. That's wonderful
    Best and kind regards
    Last edited by Feisty2; 03-14-2018 at 10:05 AM.

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    1) It is working if I change system date to Mar. All April data are transferred.
    2) If you want to delete, add one line
            With .Range("a1", .Cells.SpecialCells(11))
                .Rows("1:2").Copy Sheets("result").Cells(1)
                .AdvancedFilter 1, .Parent.[z1:z2]
                .Offset(2).Copy Sheets("result").[a3]
                .Offset(2).EntireRow.Delete  '<---- this line
            End With

  11. #11
    Registered User
    Join Date
    02-24-2018
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    97

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    Thanks a lot Mr. jindon for your great efforts

    Best Regards
    Last edited by Feisty2; 03-14-2018 at 10:06 AM.

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    OK, I see...
    Change
            .[z2].Formula = "=and(c2>=eomonth(today(),1)+1-day(today()),c2<=eomonth(today(),1))
    to
            .[z2].Formula = "=and(c2>=eomonth(today(),1)-day(eomonth(today(),1))+1,c2<=eomonth(today(),1))"

  13. #13
    Registered User
    Join Date
    02-24-2018
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    97

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    That's wonderful .. I am so grateful for you Mr. jindon

    All the best,
    Last edited by Feisty2; 03-14-2018 at 10:06 AM.

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    1) Change the formula to
    .[z2].Formula = "=or(istext(c2),and(c2>=eomonth(today(),1)-day(eomonth(today(),1))+1,c2<=eomonth(today(),1)))"
    2) If you want to sort the result then insert one line
        With Sheets("result")
            .[z2].Clear: .Columns.AutoFit
            .Range("a3", .Cells.SpecialCells(11)).Sort .Range("c3")  '<--- this line
        End With

  15. #15
    Registered User
    Join Date
    02-24-2018
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    97

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    That's Amazing and wonderful Mr. jindon and Thank you very very much for your interest in the issue
    The question now is How can replace the date in column C to word "He finished his service"
    I wish you all the best .. Best Regards
    Last edited by Feisty2; 03-04-2018 at 10:53 AM.

  16. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    Change to
    Sub test()
        Application.ScreenUpdating = 0
        On Error Resume Next
        Sheets("Result").Cells.Delete
        With Sheets("main")
            .Rows("1:2").Copy Sheets("result").Cells(1)
            .[z2].Formula = "=or(istext(c2),and(c2>=eomonth(today(),1)-day(eomonth(today(),1))+1,c2<=eomonth(today(),1)))"
            With .Range("a1", .Cells.SpecialCells(11))
                .Rows("1:2").Copy Sheets("result").Cells(1)
                .AdvancedFilter 1, .Parent.[z1:z2]
                .Offset(2).Copy Sheets("result").[a3]
                .Offset(2).EntireRow.Delete
            End With
            If .FilterMode Then .ShowAllData
            .[z2].Clear
        End With
        With Sheets("result")
            .[z2].Clear
            .Range("a3", .Cells.SpecialCells(11)).Sort .Range("c3")
            On Error Resume Next
            .Columns(3).SpecialCells(2, 1).Value = "He finished his service"
            .Columns.AutoFit
            .Activate
        End With
        Application.ScreenUpdating = 1
      End Sub

  17. #17
    Registered User
    Join Date
    02-24-2018
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    97

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    Thank you very much Mr. jindon for this perfect solution

    All the best, Best and kind regards
    Last edited by Feisty2; 03-14-2018 at 10:06 AM.

  18. #18
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    Is this the last one?

    If not you, should state what you really want in one question since I don't want to do one by one.

  19. #19
    Registered User
    Join Date
    02-24-2018
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    97

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    Thank you very much Mr. jindon for your reply
    Yes, this is the last question To complete Thread
    All the best, Best and kind regards

  20. #20
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    Try change to
    Sub test()
        Dim LastR As Range
        Application.ScreenUpdating = 0
        Sheets("Result").Cells.Delete
        With Sheets("main")
            .Cells(1).CurrentRegion.Rows("1:2").Copy Sheets("result").Cells(1)
            If Not [isref('archives'!a1)] Then
                Sheets.Add(after:=Sheets("result")).Name = "archives"
                .Cells(1).CurrentRegion.Rows("1:2").Copy Sheets("archives").Cells(1)
                Set LastR = Sheets("archives").[a3]
            End If
            .[z2].Formula = "=or(istext(c2),and(c2>=eomonth(today(),1)-" & _
                            "day(eomonth(today(),1))+1,c2<=eomonth(today(),1)))"
            With .Range("a1", .Cells.SpecialCells(11))
                .AdvancedFilter 1, .Parent.[z1:z2]
                .Offset(2).Copy Sheets("result").[a3]
                .Offset(2).EntireRow.Delete
            End With
            If .FilterMode Then .ShowAllData
            .[z2].Clear
        End With
        With Sheets("result")
            .Range("a3", .Cells.SpecialCells(11)).Sort .Range("c3")
            On Error Resume Next
            .Columns(3).SpecialCells(2, 1).Value = "He finished his service"
            On Error GoTo 0
            .Columns.AutoFit
            .Activate
            If Application.CountA(.Columns(1)) = 1 Then Exit Sub
            If LastR Is Nothing Then Set LastR = Sheets("archives").Range("a" & Rows.Count).End(xlUp)(2)
            .Range("a3", .Cells.SpecialCells(11)).Copy LastR
            LastR.Parent.Columns.AutoFit
        End With
        Application.ScreenUpdating = 1
    End Sub

  21. #21
    Registered User
    Join Date
    02-24-2018
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    97

    Re: transfer data from the main workbook to another sheet Based on the date of retirement

    Thanks a lot Mr. jindon for your great support all the time

    Best and kind regards
    Feisty
    Last edited by Feisty2; 03-14-2018 at 10:07 AM.

+ 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. Transfer data from the main sheet to another sheet depending on empty cells
    By Joky in forum Excel Programming / VBA / Macros
    Replies: 37
    Last Post: 01-19-2018, 04:01 PM
  2. Replies: 1
    Last Post: 08-25-2017, 10:21 AM
  3. Copy and transfer data from a Main sheet to two sheets based on two conditions
    By Joky in forum Excel Programming / VBA / Macros
    Replies: 29
    Last Post: 07-30-2017, 02:22 PM
  4. [SOLVED] Transfer data from one main sheet to two sheets
    By KingTamo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-28-2016, 03:53 AM
  5. Replies: 5
    Last Post: 02-09-2014, 08:29 PM
  6. Replies: 1
    Last Post: 02-13-2013, 01:32 PM
  7. Macro to transfer data from main sheet to sub sheets
    By sandbach in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-02-2010, 05:42 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