How to Replace Only the First Dash in Each Line in Word
Question details
The user needs to replace only the first dash in every text line with a different delimiter (like a tab) so they can successfully convert the text to a table.
- Product
- Word
- Device & OS
- not provided
- Scenario
- Converting a list of records (where album titles contain additional dashes) from text to a Word table.
- Observed behavior
- Word treats every dash in the line as a delimiter, creating unwanted extra columns for items containing internal dashes.
Make a backup copy of your document before running macros or performing bulk find-and-replace actions to prevent accidental data loss.
Use a VBA Macro to Target the First Dash
Using a VBA macro is the most reliable way to iterate through each paragraph and replace strictly the first occurrence of a dash without affecting subsequent dashes.
A macro can precisely identify the first hyphen or dash in every line and replace it with a new delimiter, such as a tab character, preparing the text perfectly for table conversion.
Ensure you know exactly which type of dash is in your document (hyphen, en dash, or em dash), as VBA treats them as distinct characters.
Press Alt + F11 on your keyboard to open the Microsoft Visual Basic for Applications window.
Click on 'Insert' in the top menu, then select 'Module' to create a blank script window.
Paste a VBA script designed to find the first dash (`InStr(p.Range.Text, "-")`) and replace it with your desired delimiter. Press F5 to execute the code.
Once the first dashes are replaced with tabs, highlight your text, go to Insert > Table > Convert Text to Table, and select 'Tabs' as your delimiter.
Use Advanced Find and Replace with Wildcards
You can use Word's wildcard search feature to isolate the first dash in a paragraph, provided your paragraphs start cleanly.
Pre-format Spaced Dashes
If your primary delimiters are spaced dashes (e.g., ' - ') and the extra album dashes are unspaced, you can perform a simple find and replace without wildcards.
Easily Manage Text and Tables with WPS Writer
WPS Writer offers an intuitive interface with robust Find & Replace functions, full wildcard support, and powerful text-to-table tools to help you format documents flawlessly.
- 1. Open Your Document: Launch WPS Writer and open the document containing the text you want to convert.
- 2. Use Find and Replace: Press Ctrl + H, check 'Use wildcards', and easily swap out your delimiters.
- 3. Convert to Table: Select the text, navigate to Insert > Table, and click 'Convert Text to Table' to perfectly align your data.

Frequently Asked Questions
Why does Word treat my dashes differently during search?
Word recognizes standard hyphens (-), en dashes (–), and em dashes (—) as completely different character codes. If you type a hyphen but AutoFormat changes it to an en dash, a standard hyphen search will no longer find it.
How do I convert text to a table using a custom character?
Highlight your text, go to the Insert tab, click Table, and choose Convert Text to Table. Under 'Separate text at', select 'Other' and type the specific character (like a comma, pipe, or dash) you want to act as the column divider.
How can I undo a Find and Replace mistake?
If a bulk replacement didn't work as expected, immediately press Ctrl + Z on your keyboard (or click the Undo arrow in the quick access toolbar) to revert the entire Find and Replace action.
What is the wildcard code for a tab space in Word?
In Word's standard Find and Replace, you use ^t to represent a tab. However, when using 'Use wildcards', ^t works in the 'Replace with' box, but in the 'Find what' box you must use ^t or ^9 depending on the specific pattern.




