• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

how to move and automatically sort data?|General Excel Questions & Answers|Excel Forum|My Online Training Hub

You are here: Home / how to move and automatically sort data?|General Excel Questions & Answers|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumGeneral Excel Questions & Answe…how to move and automatically sort …
sp_PrintTopic sp_TopicIcon
how to move and automatically sort data?
Avatar
Stanislava Shiakova

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
July 21, 2020
sp_UserOfflineSmall Offline
1
July 21, 2020 - 4:34 pm
sp_Permalink sp_Print

Hello, 

I would like to ask someone to help me with this:

I have a table that is filled regularly and the data is not sorted. I need all this data to be automatically copied to another file, because there we add an additional column and I linked both tables  but I want the data to be sorted automatically by submission date  in the second table.

I attach an example file with two sheets, not linked.

Thank you

P.S. Excel 2016 on PC

Avatar
Purfleet
England
Member
Members


Trusted Members
Level 4
Forum Posts: 412
Member Since:
December 20, 2019
sp_UserOfflineSmall Offline
2
July 21, 2020 - 11:27 pm
sp_Permalink sp_Print

Somthing like this?

Sub CopySort()

Worksheets("Table 1").Range("a1").CurrentRegion.Copy Worksheets("Table 2").Range("a1")

Worksheets("Table 2").Range("a:a").Columns.Insert xlToLeft

With Worksheets("Table 2").Range("a1")
.Value = "Comment"
.Interior.Color = vbBlue
.Font.Color = vbWhite
End With

Worksheets("Table 2").Range("a1").CurrentRegion.Sort KEY1:=Worksheets("Table 2").Range("C:C"), ORDER1:=xlAscending, Header:=xlYes

Worksheets("Table 2").Activate

End Sub

Avatar
Stanislava Shiakova

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
July 21, 2020
sp_UserOfflineSmall Offline
3
July 22, 2020 - 1:57 am
sp_Permalink sp_Print

Hi, yes, exactly, thank you very much.

But I won't be able to write it myself. Also, the example I gave is between two sheets, but I need this between two workbooks. 

If I attach the exact tables that I use (columns) in different workbooks, would you help me again?

Do the two workbooks need to be open in order to work?

Avatar
Purfleet
England
Member
Members


Trusted Members
Level 4
Forum Posts: 412
Member Since:
December 20, 2019
sp_UserOfflineSmall Offline
4
July 23, 2020 - 3:03 pm
sp_Permalink sp_Print

The concept is simular with 2 workbooks and we can get VBA to open the workbooks if we know where they are located.

I will update the code later and repost

Avatar
Stanislava Shiakova

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
July 21, 2020
sp_UserOfflineSmall Offline
5
August 19, 2020 - 4:41 pm
sp_Permalink sp_Print sp_EditHistory

Hi Purfleet, a kind reminder 🙂

It would make my life much easier and I apologize if I am being pushy.

Thank you

Avatar
Purfleet
England
Member
Members


Trusted Members
Level 4
Forum Posts: 412
Member Since:
December 20, 2019
sp_UserOfflineSmall Offline
6
August 21, 2020 - 3:14 am
sp_Permalink sp_Print

Sorry, completly forgot

Tried to make it as flexible as possible, might be overkill

you need to put the destination Drive,Workbook name, sheet name and range and starting worksheet name and range on the input page - this will not check is the file or range actually exists so you need to make sure the path & file name etc are 100% correct.

at the end of the code i have set the destination worksheet to autosave and the starting wort to save and close - take these out if you dont want this to happen

'Saves Destination worksheet
Workbooks(DestWb).Save

'Close orginal worksheet
Workbooks(StartWb).Close True

There is lots more that can be done to make this macro better - such as check the file are there and that the input fields are populated, but i will leave that to you to improve as you see fit.

Avatar
Stanislava Shiakova

Active Member
Members
Level 0
Forum Posts: 4
Member Since:
July 21, 2020
sp_UserOfflineSmall Offline
7
August 21, 2020 - 9:29 pm
sp_Permalink sp_Print

Thank you.

I will do my best.

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Velouria, Dario Serrati, Valentyn Kristioglo, Nada Perovic, Andrew Er
Guest(s) 9
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 871
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Raj Mattoo
Mark Luke
terimeri dooriyan
Jack Aston
AndyC
Denise Lloyd
michael serna
mashal sana
Tiffany Kang
Leah Gillmore
Forum Stats:
Groups: 3
Forums: 24
Topics: 6219
Posts: 27279

 

Member Stats:
Guest Posters: 49
Members: 31903
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.