Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-18-2018, 07:27 AM
rsrasc rsrasc is offline Need Word Macro to Delete Text Windows 10 Need Word Macro to Delete Text Office 2013
Competent Performer
Need Word Macro to Delete Text
 
Join Date: Mar 2014
Location: Germany
Posts: 148
rsrasc is on a distinguished road
Default Need Word Macro to Delete Text


Hi all,

I have a document with over 500 pages. and I would like to be able to delete all the text between the word DOLLAR VALUE and the information after that.

Here is how the information is showing in the document:

HTML Code:
 
BRITTANY 1
 
    SICK LEAVE   REGULAR HOURS                            7.50                 77.50                      40.25
 
    ANNUAL LEAVE REGULAR HOURS                            7.50     19.75
                 DOLLAR VALUE
 
KARIN 1
 
    SICK LEAVE   REGULAR HOURS       4.00                14.75      7.50      286.00
 
    ANNUAL LEAVE REGULAR HOURS       5.75                21.25                261.25   89.25
                 DOLLAR VALUE       65.44                                    2973.03
 
LACOURTNEY 1
 
    SICK LEAVE   REGULAR HOURS                                                 14.50
 
    ANNUAL LEAVE REGULAR HOURS                59.50                59.50
                 DOLLAR VALUE                631.30*
 
ALYSSA 1 
 
    SICK LEAVE   REGULAR HOURS       3.50                15.00                105.25
 
    ANNUAL LEAVE REGULAR HOURS       3.50                15.00                 37.75
                 DOLLAR VALUE       37.49                                     404.30

Here is how the information should looks after applying the macro:

HTML Code:
BRITTANY 1
 
    SICK LEAVE   REGULAR HOURS                            7.50                 77.50                      40.25
 
    ANNUAL LEAVE REGULAR HOURS                            7.50     19.75
 
 
KARIN 1
 
    SICK LEAVE   REGULAR HOURS       4.00                14.75      7.50      286.00
 
    ANNUAL LEAVE REGULAR HOURS       5.75                21.25                261.25   89.25
 
 
LACOURTNEY 1
 
    SICK LEAVE   REGULAR HOURS                                                 14.50
 
    ANNUAL LEAVE REGULAR HOURS                59.50                59.50
 
 
ALYSSA 1 
 
    SICK LEAVE   REGULAR HOURS       3.50                15.00                105.25
 
    ANNUAL LEAVE REGULAR HOURS       3.50                15.00                 37.75
 
So, basically I would like to have a macro so I can delete the word DOLLAR VALUE and any numbers after that word but not deleting the next letter or name available

As always, thank you in advance for your assistance and cooperation.

Regards!
Reply With Quote
  #2  
Old 04-18-2018, 02:32 PM
slaycock slaycock is offline Need Word Macro to Delete Text Windows 7 64bit Need Word Macro to Delete Text Office 2016
Expert
 
Join Date: Sep 2013
Posts: 256
slaycock is on a distinguished road
Default

You don't need a macro. A wildcard search and replace should so the job.
Reply With Quote
  #3  
Old 04-18-2018, 03:44 PM
Guessed's Avatar
Guessed Guessed is offline Need Word Macro to Delete Text Windows 10 Need Word Macro to Delete Text Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Search and replace for
DOLLAR VALUE*^13
with Wildcards turned on
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #4  
Old 04-18-2018, 04:27 PM
macropod's Avatar
macropod macropod is offline Need Word Macro to Delete Text Windows 7 64bit Need Word Macro to Delete Text 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

I'd be inclined to use a wildcard Find/Replace where:
Find = ^13[!^13]@DOLLAR VALUE*^13
Replace = ^p
That'll delete the leading spaces in the 'DOLLAR VALUE' lines as well.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 04-18-2018, 11:32 PM
rsrasc rsrasc is offline Need Word Macro to Delete Text Windows 10 Need Word Macro to Delete Text Office 2013
Competent Performer
Need Word Macro to Delete Text
 
Join Date: Mar 2014
Location: Germany
Posts: 148
rsrasc is on a distinguished road
Default

Thank you all for your responses, and the wildcard Find/Replace did the job.

Excellent. Much appreciated.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Word Macro to Delete Text Macro to delete text in specific styles ljd108 Word VBA 14 01-22-2019 01:22 PM
Need Word Macro to Delete Text Macro to delete rows not containing specific text Alimou Excel Programming 4 02-06-2017 07:35 AM
Need Word Macro to Delete Text Macro to delete text from cells with specific format Soenke Word VBA 4 09-01-2016 08:55 AM
Microsoft Word macro to find text, select all text between brackets, and delete helal1990 Word VBA 4 02-05-2015 03:52 PM
Need Word Macro to Delete Text Macro Delete Selected Text smonczka Word VBA 2 11-05-2011 03:18 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:17 PM.


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