Excel Membership Data to Word Document

Beaglebud

New Member
Joined
Jan 23, 2024
Messages
5
Office Version
  1. 2021
  2. 2013
Platform
  1. Windows
Background: I have a membership roster in Excel with a requirement to extract member names who have reached various years of membership in 5-year groups and print in our newsletter. These groups range from 5-65 years. I have VBA code that creates an excel sheet and lists the members in these groups. The number of rows in the year groups vary each month with some groups being blank with no members.

To Date: I have been manually eliminating blank cells, rows, and columns from the extracted member sheet each month, rearranging year groups, then copying and pasting to word document. The word document usually requires further formatting to display in newsletter properly. This is a very cumbersome and time consuming task.

Requirement: I need VBA code to copy the non blank cells by year group and write to a word document. I have the code working to create word document. The code creates a two column document with the thought of listing 5-year to 65-year (if there are members) in order by columns, but not a requirement if better way to do it. I am stuck on the code to copy from excel and write to word document in the year groups without blank cells.

Any help or suggestions greatly appreciated.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
i know this is not a vba solution - but on the new sheet in excel - can you use filter() and sort() which is available in version 2021 as your profile shows
which may then create in the sheet the view you then just copy into word, without blanks
sorry , not vba, sure other members may help - but just an idea

perhaps
A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

This will possibly enable a quicker and more accurate solution for you.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC

then put the sample spreadsheet onto a share

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone
 
Upvote 0
Background: I have a membership roster in Excel with a requirement to extract member names who have reached various years of membership in 5-year groups and print in our newsletter. These groups range from 5-65 years. I have VBA code that creates an excel sheet and lists the members in these groups. The number of rows in the year groups vary each month with some groups being blank with no members.

To Date: I have been manually eliminating blank cells, rows, and columns from the extracted member sheet each month, rearranging year groups, then copying and pasting to word document. The word document usually requires further formatting to display in newsletter properly. This is a very cumbersome and time consuming task.

Requirement: I need VBA code to copy the non blank cells by year group and write to a word document. I have the code working to create word document. The code creates a two column document with the thought of listing 5-year to 65-year (if there are members) in order by columns, but not a requirement if better way to do it. I am stuck on the code to copy from excel and write to word document in the year groups without blank cells. Screen shot of the results of extracting names into year groups.

Any help or suggestions greatly appreciated.
 

Attachments

  • Screenshot 2024-01-23 140350.jpg
    Screenshot 2024-01-23 140350.jpg
    101.7 KB · Views: 15
Upvote 0
i know this is not a vba solution - but on the new sheet in excel - can you use filter() and sort() which is available in version 2021 as your profile shows
which may then create in the sheet the view you then just copy into word, without blanks
sorry , not vba, sure other members may help - but just an idea

perhaps
A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

This will possibly enable a quicker and more accurate solution for you.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC

then put the sample spreadsheet onto a share

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone
Thank you sir. I uploaded a reduced size screen image of the process showing the year groups after extracting from the membership roster. These year groups change each month.
 
Upvote 0
thanks for that info
in each section , are there enough rows to show all possible results
I'm just aware that if FILTER() is used - then if there are not enough rows to show - then you get a SPILL error
however it would be worth seeing the data source please
 
Upvote 0
thanks for that info
in each section , are there enough rows to show all possible results
I'm just aware that if FILTER() is used - then if there are not enough rows to show - then you get a SPILL error
however it would be worth seeing the data source please
Yes there is enough rows in each section to hold the varying numbers in the year groups. I have uploaded a small sample of the data source. There are 249 rows like the ones shown, however the last column (published years) changes based on their approval date. The code I have written now, reads through the source sheet and compares the days of service to the number of years in 5, 10, 15 etc. days. If their days of service changes, it writes their name to a different year group for publication. If there is already a year published and the days of service have not increased to the next year group, the code ignores them, so the number in each year group can be zero or more. Hope this makes sense.
 

Attachments

  • Length of service_screen.jpg
    Length of service_screen.jpg
    202.2 KB · Views: 11
Upvote 0
how about using
=FILTER($A$2:$A$17,$G$2:$G$17=TEXTBEFORE(O1,"_")*1)
which uses the published years

i dont follow how this is working or what is required

If you need VBA - sorry i do not provide VBA solutions here

difficult to follow these images

a very rough mockup on a single sheet

Book2
ABCDEFGHIJKLMNO
1first namelast namepublished years5_yrs10_yrs15_yrs
2A15A1A3A5
3A25A2A4A6
4A310A14A15A7
5A410A16
6A515
7A615
8A715
9A820
10A920
11A1020
12A1120
13A1220
14A1320
15A145
16A1510
17A1615
Sheet1
Cell Formulas
RangeFormula
K2:K4,O2:O5,M2:M4K2=FILTER($A$2:$A$17,$G$2:$G$17=TEXTBEFORE(K1,"_")*1)
Dynamic array formulas.
 
Upvote 0
Sorry for any confusion or lack of clarity. You say you don’t understand what is required or need for VBA. Here is my original question/requirement:

Requirement: I need VBA code to copy the non blank cells by year group and write to a word document. I have the code working to create word document. The code creates a two column document with the thought of listing 5-year to 65-year (if there are members) in order by columns, but not a requirement if better way to do it. I am stuck on the code to copy from excel and write to word document in the year groups without blank cells.

I have already filtered the data and written to a different sheet. The requirement is to write the filtered data to a word document is some sort of organized method avoiding blanks,
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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