Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-20-2012, 06:29 AM
Nibbles Nibbles is offline Blank Line Supression Windows 7 64bit Blank Line Supression Office 2010 64bit
Novice
Blank Line Supression
 
Join Date: Nov 2012
Posts: 9
Nibbles is on a distinguished road
Default Blank Line Supression

Hi, wonder if anyone can help.

I have a mail merge that is bringing in data from a csv. All the data imports perfectly. To line things up, I created it in a 2 column x 1 row table. This also has the advantage that the row auto resizes to the height required to display all the grades that aa customer has, and not leave a big blank space.Specifically, it has metal grade in one column and metal price in the other.

Now, to group certain things together, for example metal turnings (there may be copper, steel and brass turnings) I want a line space to appear between those and the other grades. To do this I have tried using some IF functions and another data point (called Metal#x) for the mail merge to determine if it is meant to be blank (and therefore add a space to the line to stop it being deleted) or if it is the last piece of data and can be deleted, along with anything below.



The code I came up with is thus;

Code:
 { IF { MERGEFIELD Metal3 }="" "{ IF { MERGEFIELD Metal3x }="x" " " "" }" "{ MERGEFIELD Metal3 }" }
My data has the form

Metal1 Metal1Price Metal1x Metal2 Metal2Price Metal2x etc

The x column was designed so that I could put an x in that column if it was left blank for a reason (because I wanted to space it out) but if it was left blank because there was no other data (they may only have 1 metal grade, for example) there would be no x (cell would be blank).

A picture might help demonstrate what I mean;



The numbers demonstrate which metal# it is. So in this case, Metal2x and Metal5x would have an x in and so a space should be inserted to stop the line being removed, but Metal7x through Metal15x would not and should therefore be removed.

But no matter what I try, I cant get it to remove anything below, in this example, metal6. If i look at the space formatting it has added a load of [ENTER]'s.

Anyone have any thoughts? I suspect its something obvious!
Reply With Quote
  #2  
Old 11-20-2012, 11:04 PM
macropod's Avatar
macropod macropod is offline Blank Line Supression Windows 7 64bit Blank Line Supression Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Nibbles,

It would be helpful if you could attach a file to a post with some representative csv data and document showing the desired output format. You do this via the paperclip symbol on the 'Go Advanced' tab.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-21-2012, 12:14 AM
Nibbles Nibbles is offline Blank Line Supression Windows 7 64bit Blank Line Supression Office 2010 64bit
Novice
Blank Line Supression
 
Join Date: Nov 2012
Posts: 9
Nibbles is on a distinguished road
Default

Hi Paul, ive uploaded a small demo file that might explain it better.

Although the final file is much larger with much more data it has the same basic components.

Essentially, the boxes that are shaded green are what I want to retain, rather than the line being surpressed. To do this, i'd put an x in the metal#x box to tell it that that line isnt the last one and make an IF function that looks for that x in the line below. If it finds it it would add a space to stop the line being surpressed but if not would surpress it as normal. That way, the overall size of the table would only be for the number of entries actually required.

Hope that helps!

Steve
Attached Files
File Type: xlsx demo.xlsx (9.7 KB, 8 views)
Reply With Quote
  #4  
Old 11-21-2012, 12:53 AM
macropod's Avatar
macropod macropod is offline Blank Line Supression Windows 7 64bit Blank Line Supression Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You should be able to handle those scenarios easily enough with field coding like:
{IF{MERGEFIELD Metal3x} = "x" "¶
"}
where the ¶ is a paragraph break or manual line break.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 11-21-2012, 02:32 AM
Nibbles Nibbles is offline Blank Line Supression Windows 7 64bit Blank Line Supression Office 2010 64bit
Novice
Blank Line Supression
 
Join Date: Nov 2012
Posts: 9
Nibbles is on a distinguished road
Default

Aha, thats done it, thanks. Knew it would be something simple!

For reference, I ended up with the code;

Code:
{ MERGEFIELD Metal1 }¶
{ IF { MERGEFIELD Metal2x } = "x" "¶
" }{ MERGEFIELD Metal2 }¶
{ IF { MERGEFIELD Metal3x } = "x" "¶
" }{ MERGEFIELD Metal3 }¶

and so on!
And it works perfectly
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Blank Line Supression Line Numbering & Blank Lines Ephasa Word 9 04-30-2020 02:09 PM
How to Center One Line Vertically on Blank Page SQLUSA Word 1 08-29-2012 08:14 PM
Blank Line Supression Need help on Macro 03- Find text - if text is blank then remove line simpleonline1234 Word VBA 1 02-25-2011 02:28 AM
Blank Line Supression How to turn all blank lines into non-blank for legal forms sieler Word 3 04-12-2009 01:38 PM
When i clicked on a file, it showed up blank.(LIFE ON LINE)! angelo1405 Word 0 03-17-2008 04:47 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:26 AM.


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