• 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
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
  • Login

Help me with a macro please|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / Help me with a macro please|VBA & Macros|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 ForumVBA & MacrosHelp me with a macro please
sp_PrintTopic sp_TopicIcon
Help me with a macro please
Avatar
julie vandermeulen
Member
Members
Level 0
Forum Posts: 15
Member Since:
November 8, 2018
sp_UserOfflineSmall Offline
1
December 17, 2018 - 1:46 am
sp_Permalink sp_Print

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
Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4619
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
2
December 17, 2018 - 8:11 am
sp_Permalink sp_Print sp_EditHistory

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

Avatar
julie vandermeulen
Member
Members
Level 0
Forum Posts: 15
Member Since:
November 8, 2018
sp_UserOfflineSmall Offline
3
December 17, 2018 - 9:23 am
sp_Permalink sp_Print

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!

Avatar
SunnyKow
Puchong, Malaysia

VIP
Members


Trusted Members
Level 8
Forum Posts: 1432
Member Since:
June 25, 2016
sp_UserOfflineSmall Offline
4
December 17, 2018 - 11:37 am
sp_Permalink sp_Print

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

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Philip Treacy, Peter Venkatrao, QSolutions Group
Guest(s) 8
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 880
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 237
Jessica Stewart: 219
A.Maurizio: 213
Aye Mu: 201
Hans Hallebeek: 185
Newest Members:
Kate Dyka
Kwaje Alfred Mogga
thong nguyen
Appiagyei Kofi Frimpong
Hilary Burchfield
Richie Wright
Adel Kock
Barbara Murray
Doug Milne
Siobhan Stringer
Forum Stats:
Groups: 3
Forums: 24
Topics: 6546
Posts: 28655

 

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

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel Office Scripts
  • 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

Sign up to our newsletter and join over 400,000
others who learn Excel and Power BI with us.

 

Company

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

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.