Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I replace non-constants in word?
Is there any way that I can replace in word when something is not constant? I
am copying columns over from Excel. Some are in two columns and some are in three. A, B and C change on each line For example I need to replace A tab tab B tab tab C with A tab B tab C I can't just replace tab tab with tab as this affects the two column and I end up with A tab C. Do I use a wildcard and if so how do I do it? Many thanks for any help you can give |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I replace non-constants in word?
"Terry D" wrote:
Is there any way that I can replace in word when something is not constant? I am copying columns over from Excel. Some are in two columns and some are in three. A, B and C change on each line For example I need to replace A tab tab B tab tab C with A tab B tab C I can't just replace tab tab with tab as this affects the two column and I end up with A tab C. Do I use a wildcard and if so how do I do it? I am sorry, but I don't follow. If, as you write, you have A tab tab B tab tab C and you do a Find/Replace where you replace "tab tab" by "tab," you will end up with A tab B tab C not A tab C |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I replace non-constants in word?
"Jean-Guy Marcil" wrote: "Terry D" wrote: Is there any way that I can replace in word when something is not constant? I am copying columns over from Excel. Some are in two columns and some are in three. A, B and C change on each line For example I need to replace A tab tab B tab tab C with A tab B tab C I can't just replace tab tab with tab as this affects the two column and I end up with A tab C. Do I use a wildcard and if so how do I do it? I am sorry, but I don't follow. If, as you write, you have A tab tab B tab tab C and you do a Find/Replace where you replace "tab tab" by "tab," you will end up with A tab B tab C not A tab C Sorry it's a bit confusing: What I'm trying to do is replace the following: John [tab][tab]Michael [tab][tab]Jones John[tab][tab]Smith so can copy back into excel (where the [tab] is a column break I need the [tab][tab]Michael[tab][tab] to be [tab]Michael][tab] where Michael is a variable. if I replace [tab][tab] with [tab] it changes the John Smith line and that needs to stay the same. Hope this makes more sense. |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I replace non-constants in word?
Am I correct that two consecutive tabs corresponds to an empty cell between
those two tabs? And, a line that begins with a tab indicates that the 1st cell in that row is empty? If so, I'd do this in multiple steps, and replace all of the empty cells with token placeholders you can delete later on. 1. Find:^p^t Replace:^p[placeholder]^t This puts a placeholder at the begging of any row with an empty first cell. 2. Find:^t^t Replace:^t[placeholder]^t This puts placeholders in the interior for any empty cell. 3. Find:^t^p Replace:^t[placeholder]^p This puts a placeholder at the end of any row with an empty last cell. But.. a bigger question is "Why do you have tabs at all?" When pasting to/from Excel, it's possible to paste as a Word table, then paste back into Excel's row/column structure, which are far easier to work with than tabbed columns. -- Herb Tyson MS MVP Author of the Word 2007 Bible Blog: http://word2007bible.herbtyson.com Web: http://www.herbtyson.com "Terry D" Terry wrote in message ... Is there any way that I can replace in word when something is not constant? I am copying columns over from Excel. Some are in two columns and some are in three. A, B and C change on each line For example I need to replace A tab tab B tab tab C with A tab B tab C I can't just replace tab tab with tab as this affects the two column and I end up with A tab C. Do I use a wildcard and if so how do I do it? Many thanks for any help you can give |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I replace non-constants in word?
"Terry D" wrote:
Sorry it's a bit confusing: What I'm trying to do is replace the following: John [tab][tab]Michael [tab][tab]Jones John[tab][tab]Smith so can copy back into excel (where the [tab] is a column break I need the [tab][tab]Michael[tab][tab] to be [tab]Michael][tab] where Michael is a variable. if I replace [tab][tab] with [tab] it changes the John Smith line and that needs to stay the same. Try this: Find What: ([A-z0-9 ]@^t)^t([A-z0-9 ]@^t)^t([A-z0-9 ]@^13) Replace with: \1\2\3 Make sure to turn on the Wild card option (Click on More first). The above means: ([A-z0-9 ]@^t) = [any letter, any number or space]any number of occurences of the preceding(@) followed by a tab(^t). The ( ) indicate that this is group. ^t = a tab (Not part of any groups, it is not in between any pair of brackets.) ([A-z0-9 ]@^t)^t = [any letter, any number or space]any number of occurences of the preceding followed by a tab. The ( ) indicate that this is group. ^t = a tab ([A-z0-9 ]@^13)= [any letter, any number or space]any number of occurences of the preceding followed by a paragraph mark(ΒΆ). The ( ) indicate that this is group. Replace with \1 = The first group \2 = The second group \3 = The third group So, this deletes the extra tabs. |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I replace non-constants in word?
Replace
^t(^t[A-Za-z]{1,}^t)^t with \1 with the wildcard option set http://www.gmayor.com/replace_using_wildcards.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Terry D wrote: "Jean-Guy Marcil" wrote: "Terry D" wrote: Is there any way that I can replace in word when something is not constant? I am copying columns over from Excel. Some are in two columns and some are in three. A, B and C change on each line For example I need to replace A tab tab B tab tab C with A tab B tab C I can't just replace tab tab with tab as this affects the two column and I end up with A tab C. Do I use a wildcard and if so how do I do it? I am sorry, but I don't follow. If, as you write, you have A tab tab B tab tab C and you do a Find/Replace where you replace "tab tab" by "tab," you will end up with A tab B tab C not A tab C Sorry it's a bit confusing: What I'm trying to do is replace the following: John [tab][tab]Michael [tab][tab]Jones John[tab][tab]Smith so can copy back into excel (where the [tab] is a column break I need the [tab][tab]Michael[tab][tab] to be [tab]Michael][tab] where Michael is a variable. if I replace [tab][tab] with [tab] it changes the John Smith line and that needs to stay the same. Hope this makes more sense. |
#7
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I replace non-constants in word?
"Graham Mayor" wrote: Replace ^t(^t[A-Za-z]{1,}^t)^t or ^t(^t[A-z0-9 ]@^t)^t in case there are numbers or spaces... Much more elegant to look only for the middle column instead of the whole line as I did! |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
replace variables (auto-numbered paragraph numbers) with constants | Microsoft Word Help | |||
how to change constants in a word document with drop downs | Microsoft Word Help | |||
VBA in Word 2003 - headerfooter constants | Page Layout | |||
Document Constants | Microsoft Word Help | |||
Enumeration constants | Mailmerge |