Dec 02 2021 01:10 AM - edited Dec 02 2021 02:49 AM
Hello everybody & thankyou in advance for considering my problem! I have 2 sheets. Sheet 1 (26 columns by 85896 rows) and Sheet 2 (15 columns by 43201 rows).
Both of the sheets contain different variables with different values however they both share similarities in the time column (column A). For example, Sheet 1 records data almost every 1 second of a day while Sheet 2 records data every 2 seconds of the day. I am looking to create a macro so that I am able to compare the time column in sheet 1 to sheet 2, if it matches, I would like to copy the row of data from both sheets and put it into a new sheet 3. The result would be a fresh sheet (sheet 3), that contains the data from both tools/sheets when they are recorded at the same time.
Currently I am really struggling with this, any help would be really really appreciated! Thanks so much for having a look at this, and if you can help, please let me know! Thanks again!
Dec 02 2021 02:22 AM
@Rory123908 I'd suggest you forget about VBA and look into PowerQuery in stead. Quite easy, I dare to say, though difficult to demonstrate with some real data to play with. Can you upload a file that represents the actual structure of your real sheets/tables? Say, a hundred rows of data in each or so, with matching time-stamps between the two. Remove any private and/or confidential information, though.
Dec 02 2021 02:53 AM
Dec 02 2021 03:27 AM
@Rory123908 Thanks! Attached file now includes a sheet with records from both tables, every 2nd second. Is that what you had in mind. The PQ steps are relatively simple but it needs getting used to if you have never worked with it before.
This would be a good starting point to learn more about it.
Dec 02 2021 04:02 AM
Dec 02 2021 04:25 AM
@Rory123908 If you insist on VBA, I can't help. But your description is definitely suited for Power Query. Once set-up correctly, it can be used over and over again. The user doesn't even have to see the individual files you currently have in Sheet1 and Sheet2. All they would need to learn is to right-click in the merged. But perhaps I underestimate the complexity of your issue.
Dec 02 2021 08:19 AM
Dec 02 2021 08:34 AM
@Rory123908 I'm sure you could automate PQ in conjunction with VBA, but that would go beyond the scope of this "Help-forum", I think. And I'm not really comfortable with VBA.