Macro needed to insert 4 rows in table, copy data from above, copy data from another sheet and paste special (transpose values) to those new rows...repeat till table complete

Christine Potter 0 Reputation points
2024-09-17T20:10:05.2766667+00:00

Hey smart people! I'm a novice at macros and have found myself in a little too deep to handle this task with a macro and don't know VBA language to get this done.

I have a spreadsheet with multiple sheets. My macro needs to:

  1. Select the main sheet.
  2. Make task relative.
  3. drop down 1 line
  4. Insert 4 lines
  5. Copy the data from one cell above to the same cells in those 4 new lines
  6. Copy images (https://...) from Other Sheet over to the main sheet to those new lines into the appropriate cell of the newly inserted lines. Those images are on the one row in 4 cells (4 columns) in the Other Sheet and need to be transposed to the one cell (1 column) in the next 4 lines down and just as values (not formulas).
  7. then go down to the next line item to set up for the next repetitive motion till all items in the Main Sheet table are completed.

As data is input differently from the month before, the Main Sheet and Other Sheet will be different in number of filled rows each time so I need to make the macro stop after it can't find any more data to alter.

Can anyone help steer me to the best way to conquer this, please?

Microsoft 365 and Office | Development | Other
Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Barry Schwarz 3,746 Reputation points
    2024-09-17T21:30:55.3966667+00:00

    Turn on Macro recording. Perform tasks 1-6 manually. Turn off macro recording.

    Study the resulting macro to learn at least some VBA basics,

    Post the macro and tell us specifically what data task 7 should work on and how it can determine all items are complete. It wouldn't hurt to show us before and after sample data either.


  2. Christine Potter 0 Reputation points
    2024-11-08T01:02:36.78+00:00

    I was able to build 2 semi-simple macros to get the job done. I've never built macros before and always relied on formulas...until I realized that you can't make functions work in formulas. The need to assist an acquaintance helped to inspire me to figure it out on my own and finding a cool tutorial online. https://youtu.be/33Ej8DPsdvA?si=ykFX9GW2mI6nzIMQ

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.