Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-17-2013, 06:49 PM
jonpackbosoxfan jonpackbosoxfan is offline Merge data from excel into word Windows 8 Merge data from excel into word Office 2010 64bit
Novice
Merge data from excel into word
 
Join Date: Sep 2013
Posts: 15
jonpackbosoxfan is on a distinguished road
Default

Okay so I generally understand some of the concepts here. The VBA code that is written searches the particular date column and if it comes across any data in that row it records it in the printout sheet starting in Z1 and working on down, pulling the associated name in that row.



I guess where I am struggling is that if it finds nothing in the first row it records noting in Z1 of the printout sheet. So in the case of the date that has been shown it ends up skipping the first 7 lines of the Z column and finally recording the name of Derrick Bishop in Z8.

So in the actual printout what confuses me is how does the formula that is there know to skip the first 7 rows that no data exists and move to row 8. I would think that it would record no data in the first 8 rows. I guess I am really confused by how the formula knows to skip no data.

So then if i added more cells to create additional spaces, and use the fill handle its just going to produce the next number.

Still confused. Thank you for helping me learn this though because it has been interesting. I understand the worksheet a little better, but i admit that while i generally understand the concepts of the VBA code the specifics of the lingo that is being used is way over my head.

Jonathan
Reply With Quote
  #2  
Old 09-17-2013, 07:34 PM
BobBridges's Avatar
BobBridges BobBridges is offline Merge data from excel into word Windows 7 64bit Merge data from excel into word Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

Quote:
The VBA code that is written searches the particular date column and if it comes across any data in that row it records it in the printout sheet starting in Z1 and working on down, pulling the associated name in that row.
Not Z1; it starts in row 8. Notice the line in the program that says "y = 8"? It uses y as the row number for the output; it starts it at 8 and then increments it from there. I don't know why it should use 8, but it doesn't really matter.

And that's why the formula skips over the first seven rows: because the author (I presume that, too, was excelledsoftware) knew that's where the data started. So you're not imagining things; the formula had to point to the right place. It's just that the formula was told that the right place to start was row 8—that is, it was constructed using Y8 as the starting place.

Does that help you see what you have to do? If you add more lines to the bottom of the report (after row 32, I mean), how does that affect what has to happen in the formulae in cols C and D?

Quote:
....while i generally understand the concepts of the VBA code the specifics of the lingo that is being used is way over my head.
Whenever that happens, stop me and ask! I used to think there must be something wrong with me because I didn't understand the terminology that other people considered basic, and what I learned is not that there's nothing wrong with me but that it doesn't matter: The only way to make up the deficit is to start asking, even at the risk of making a pest of myself.
Reply With Quote
  #3  
Old 09-17-2013, 08:31 PM
excelledsoftware excelledsoftware is offline Merge data from excel into word Windows 7 64bit Merge data from excel into word Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

Quote:
Originally Posted by jonpackbosoxfan View Post
Okay so I generally understand some of the concepts here. The VBA code that is written searches the particular date column and if it comes across any data in that row it records it in the printout sheet starting in Z1 and working on down, pulling the associated name in that row.

I guess where I am struggling is that if it finds nothing in the first row it records noting in Z1 of the printout sheet. So in the case of the date that has been shown it ends up skipping the first 7 lines of the Z column and finally recording the name of Derrick Bishop in Z8.

So in the actual printout what confuses me is how does the formula that is there know to skip the first 7 rows that no data exists and move to row 8. I would think that it would record no data in the first 8 rows. I guess I am really confused by how the formula knows to skip no data.

So then if i added more cells to create additional spaces, and use the fill handle its just going to produce the next number.

Still confused. Thank you for helping me learn this though because it has been interesting. I understand the worksheet a little better, but i admit that while i generally understand the concepts of the VBA code the specifics of the lingo that is being used is way over my head.

Jonathan
Here is my recommendation when it comes to learning VBA or any language for that matter.

All computer languages have functions, methods, variables blah blah blah. What I have found is that you need to program your mind first before programming starts to make sense. Here is my suggestion on what you should learn for VBA and in what order.

1. Macro recording (Start using the macro recorder to do simple operations then look at the code after. Trust me a lot of it wont make sense but some will.
2. Write your first msgbox macro Something simple like
sub boxxy ()
msgbox "Hi there everybody"
end sub

You will notice on the msgbox when typing that it will show you alot more things you can enter. Here is a hint if those things are in [square brackets] they are optional.
3. write your first inputbox macro (Very similar to msgbox)
4. Start understanding variables and datatypes. There is a ton of info out there on these. Use simple ones like strings and integers to begin with.
Example
dim boxxy as string
boxxy = "Here is a message boxy from boxxy"
msgbox boxxy
end sub

5. once you have variables down a little bit start writing if statements. Try it with an input box and a message box.
Start with
sub boxxy ()
dim boxxyPrmpt as integer
boxxyStr = "message 1"
boxxyprmpt = inputbox("Enter a number from 1 to 100")

if boxxyPrmpt > 50 then
msgbox "Higher than 50 entered"
else
msgbox "Less than 50 entered"
end if
end sub

You can even declare 2 more string variables and assign them to the 2 msgbox's

6. Loops learn the For (stands for "For this instance") and Do You will also need to understand the range function and maybe cells
research these and let us know what you run into.

It goes slow at first but gets a lot easier as you go.
Reply With Quote
  #4  
Old 09-17-2013, 09:15 PM
jonpackbosoxfan jonpackbosoxfan is offline Merge data from excel into word Windows 8 Merge data from excel into word Office 2010 64bit
Novice
Merge data from excel into word
 
Join Date: Sep 2013
Posts: 15
jonpackbosoxfan is on a distinguished road
Default

Okay I think i got it all figured out. Take a look guys and let me know what you think.

Jonathan

2013 Membership Attendance.xls
Reply With Quote
  #5  
Old 09-18-2013, 07:08 AM
BobBridges's Avatar
BobBridges BobBridges is offline Merge data from excel into word Windows 7 64bit Merge data from excel into word Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

Looks right to me, Jonathan. I expected you to expand downward; it didn't occur to me to expand to the right, but what you have should work perfectly.
Reply With Quote
  #6  
Old 09-18-2013, 07:21 AM
jonpackbosoxfan jonpackbosoxfan is offline Merge data from excel into word Windows 8 Merge data from excel into word Office 2010 64bit
Novice
Merge data from excel into word
 
Join Date: Sep 2013
Posts: 15
jonpackbosoxfan is on a distinguished road
Default

I did initially expand downward, but when I printed it out I didnt like the look of it, so I decided to go sideways.

Do you think you could walk me through how to do the part you talked about where instead of entering a date, when i hit the populate report button it just goes based upon whatever column it is in.

Real interested in how to make that function.

Jonathan
Reply With Quote
  #7  
Old 09-18-2013, 07:43 AM
BobBridges's Avatar
BobBridges BobBridges is offline Merge data from excel into word Windows 7 64bit Merge data from excel into word Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

Quote:
Originally Posted by jonpackbosoxfan
Do you think you could walk me through how to do the part you talked about where instead of entering a date, when i hit the populate report button it just goes based upon whatever column it is in.

Real interested in how to make that function.
Yes, I can! I'm glad you asked. Um...would you rather switch to email? It might be easier, especially if we're going to start using screen shots; and I'm not convinced this will be of general interest to anyone else. (If anyone else wants to see this, speak up.) If you want to contact me directly, I'm at robhbridges (at) gmail.com.
Reply With Quote
  #8  
Old 09-18-2013, 08:38 AM
jonpackbosoxfan jonpackbosoxfan is offline Merge data from excel into word Windows 8 Merge data from excel into word Office 2010 64bit
Novice
Merge data from excel into word
 
Join Date: Sep 2013
Posts: 15
jonpackbosoxfan is on a distinguished road
Default

Quote:
Originally Posted by BobBridges View Post
Yes, I can! I'm glad you asked. Um...would you rather switch to email? It might be easier, especially if we're going to start using screen shots; and I'm not convinced this will be of general interest to anyone else. (If anyone else wants to see this, speak up.) If you want to contact me directly, I'm at robhbridges (at) gmail.com.
Yeah switching to email would be a lot easier for me.

Jonpackbosoxfan@gmail.com
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Merge data from excel into word data from Excel into Word table ragesz Word Tables 1 09-29-2013 06:14 PM
converting a word document to a data file for mail merge drsuis Mail Merge 4 02-21-2013 03:34 PM
Merge data from excel into word How can I revise Excel data source in merge? navysalad Mail Merge 6 01-07-2012 06:50 PM
Merge data from excel into word Wine List, Data Merge - Excel to Publisher - Or other suggestions? daym Publisher 2 05-01-2011 03:45 AM
How do I set up the fields in mail merge word 07 from my data base mbcrabber Mail Merge 4 06-06-2010 01:25 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:51 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft