Macro beginner questions

shakethingsup

Board Regular
Joined
May 21, 2017
Messages
64
Office Version
  1. 365
Platform
  1. Windows
Hi,

Over the last week I've been teaching myself to develop very simple macros with goals of becoming a master one day.

My questions in red are:

1. can anyone recommend beginner tutorial sites similar to this one that I've been using https://www.homeandlearn.org/index.html?

2. Ultimately, I want to be able to create macros and apply them to multiple workbooks and excel files. I want my teams to be able to use those macros eventually.

I've come across two options:
1. personal workbook
2. add-ins

I'm trying to find my "personal workbook" but can't. One suggestion I found was to run a dummy macro and use "store macro in" - I don't have this option.

Can someone point me to a resource to help find or create a personal workbook?


3. I'm learning how to be a bit more efficient with the code but my logic isn't there yet so be patient!

I have a file that looks like this:
Do9i8y9.png


Ultimately I want to do the following to start:

1. Fill all blank cells in column A with a specific value. I have learned about the lastrow function. I find the lastrow with data and then fill accordingly with a loop. But it seems my code runs slow.
2. delete columns B,D,E,F
3. Combine column K + L into one column and sum the amounts and call it Over 90 days
4. Move column N ahead of column G
5. filter the rows b column N in descending order

Q - What I don't fully understand yet is should I create different subs for each of these tasks? is there a way to write code that does all of this at once? Every month we produce this spreadsheet and every month we do the same things over and over again.
Q - when I created a deletesub, it only deletes one column at a time - how do I get excel to delete everything at once?

I haven't researched steps 3 to 5 yet so in all honestly, I haven't tried anything.

Sub Delete_EntireColumn ()
Columns("B").EntireColumn.Delete
Columns("D").EntireColumn.Delete
End Sub
4pCoq


THANK YOU!
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
If you overload a single thread with too many questions, you are likely to scare people off, and not get too many replies. Best to break your threads into separate tasks, where you are asking a specific question, or about one specific process.

In regards to help and tutorials, hiker95 has put together an extensive list, that you can see here: https://excellusbcbsdev.service-now.com
Also, you will find that Google searches are a great way to find almost anything. Most questions you have asked can usually be found somewhere on the internet.

You can also get a lot of the VBA code that you need by turning on the Macro Recorder and record yourself doing the steps manually, and then viewing your code. Sometimes, you might need to clean it up a little, or make it dynamic, but it will get you a lot of what you need.

1. Fill all blank cells in column A with a specific value. I have learned about the lastrow function. I find the lastrow with data and then fill accordingly with a loop. But it seems my code runs slow.
Loops are not needed for this. See this: https://www.extendoffice.com/docume...-blank-cells-with-0-or-specific-value.html#a1 (found with a Google search)

2. delete columns B,D,E,F
Can be done all at once like this:
Code:
Sub DeleteColumns()
    Range("B:B, D:F").EntireColumn.Delete
End Sub
You can keep adding commas, and more columns.

A lot of your other items you listed you can get the code for using the Macro Recorder.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top