Forum

Help me with a macr...
 
Notifications
Clear all

Help me with a macro please

4 Posts
3 Users
0 Reactions
63 Views
(@dreamingbig2att-net)
Posts: 15
Eminent Member
Topic starter
 

Everyday I run a report in excel.  I spend some time formatting it and would like to run a macro.  I’m new to macros and don’t understand how to write them or the language but understand how to record them.  In my spreadsheet I can get it to do every step but steps 4, 5, and 8.  I know there must be a way to do this but not sure how.  Hoping someone can walk me through the steps and explain it in English so I can record the macro and save time at work.

  1. Delete row 1
  2. Sort by location, then last name
  3. Delete column C, H, and I
  4. Delete rows that aren’t location x
  5. Add Boss 1 and Boss 2 to next available row
  6. Add 2 rows at top
  7. Type location name and date
  8. Sum columns E, F, and G
  9. Set printer settings
 
Posted : 17/12/2018 11:46 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Julie,

All of this can be done with Power Query except step 9: Printer settings, but you should be able to record a macro for that.

Note: Step 5 isn't in the attached file because I didn't understand whether you mean add two rows at the end of the table before the sums mentioned in step 8, or to add two rows after every row, or whether I was even adding two rows, maybe you meant 1 row with Boss 1 and Boss 2 in a single cell.... so many questions about this step that an example would be clearer.

Step 7 wasn't done either because I didn't know where you wanted to type the location name and date. Is this on every row?

Perhaps you could share the 'after' view of what you'd like to see so we can fill in the missing steps. Please use the file attached which already has the query part completed.

Thanks,

Mynda

 
Posted : 17/12/2018 6:11 pm
(@dreamingbig2att-net)
Posts: 15
Eminent Member
Topic starter
 

Mynda

The spreadsheet is exported each day from another source so we really just want a macro to run the whole thing and print the sheet and then we don't use the sheet again.  Just trying to hit one key to run the macro and type in 2 numbers each day then print it and be done rather than spending 5 minutes formatting it before we can enter the information we need and then discard it.

I can figure out the macro for everything except steps 4, 5, and 8.

In step 4 I need to delete all rows not in location x

In step 5 I need to then enter Boss 1 in the first available row (I type in manually his rt and ot after as that changes everyday), then in the row under that type in Boss 2 (I type in manually his rt and ot as well)

In step 8 I need to sum the rt, ot, and th columns (this is different everyday depending on the number of rows

Was hoping you could explain the steps i could take to do this so I can record the macro.  

I've attached a before and after copy. Hoping this helps!

 
Posted : 17/12/2018 7:23 pm
(@sunnykow)
Posts: 1417
Noble Member
 

Hi Julie

Please refer attachment.

You will need to set the macro to run on a specific sheet.

I have set it to the Report sheet.

Hope this helps.

Sunny

 
Posted : 17/12/2018 9:37 pm
Share: