Is there a way to make quick VBA routines in MS Word?

DataAnalyst

New Member
Joined
Mar 23, 2012
Messages
44
Even though my title is Data Analyst, more than 50% of my work is financial. I've written VBA code in the past and when I was first at this job but since I don't have extensive experience, it's not a fast process. My boss likes me to work as fast and efficiently as possible, and I usually have non-VBA projects waiting, often urgently.

So I can't take the time to research and write code, and see if it works, and figure out why it doesn't, etc...

I often find myself with a project where I have to sort, copy, count, etc. a small dataset. It would be nice to have some code to do it so I don't have to do it manually - but it would take longer to research and write the code than to do it manually, so I don't write the code. I'm going to work on learning more, starting with hiker95's list.

Right now I have 3 sets of 2017 calendars by month in MS Word originally made as a table, with a name on each day. The table cell with the day also includes the number of the day and sometimes other text.

I have to count the number of occurrences of each name for each month, and enter them in an Excel table. I did some quick research looking for a function or macro for this and didn't find anything... so I'm doing it manually with the Find function and there must be a better way. I tried copying it into Excel, but then the data would have to be completely rearranged for each month x3, and again, it's quicker to count it manually.

I saw an example here of starting from Excel and writing code to extract data from a Word table. Once again, I don't have time to learn and research this code.

Is there a quick and simple way to count names in Word table cells, with or without Excel?

Are there any further suggestions about how I can learn this without taking so much time?

Thanks so much for any suggestions! :)
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
One way you could count things in a Word document is to do a search and replace using the same text for replace as you use for search. So if you search for "dog" and replace it with "dog," Word will tell you how many occurrences it replaced.

To make quick VBA routines in Word, consider recording macros. The result won't be the most efficient way, but it should work (recorded macros in both Word and Excel use the selection object, instead of the more efficient range object).

I hear your frustration about the time this stuff takes to learn! There really aren't any shortcuts, though. :( Do you find it interesting enough that you can learn on your own time, little by little? The time you invest will likely pay off when you learn; you'll be able to do things much more quickly.

Also, consider breaking down some of your tasks into sub-tasks that you can carry out with recorded macros. Sometimes you can't automate the whole thing but you can still save time by automating parts of it.
 
Upvote 0
Thanks Robert SF! I'll try using more macros. :)

I don't have enough time outside of work either, but my boss said I can spend some work time after this one big project, and I'll hold him to that. ;)
 
Upvote 0
One way you could count things in a Word document is to do a search and replace using the same text for replace as you use for search. So if you search for "dog" and replace it with "dog," Word will tell you how many occurrences it replaced.
You don't even need to do a Replace (which sets the document's saved state to 'dirty' (unsaved)). All you need do is a Find and choose the Reading Highlight option. Not only will that tell you how many there are, it will also highlight them for you!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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