Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-17-2017, 01:48 PM
Tye30 Tye30 is offline Delete Character on Single Line Only Windows 7 32bit Delete Character on Single Line Only Office 2010 32bit
Novice
Delete Character on Single Line Only
 
Join Date: Apr 2017
Posts: 7
Tye30 is on a distinguished road
Default Delete Character on Single Line Only


Hello All,

I have made several macros using the Macro Recorded language and I am looking for help to learn and update my macros to a more efficient style, mainly to speed up the macros.



Code:
 
 Sub TEST_REVISE()
 
    Selection.HomeKey Unit:=wdLine:
    Selection.MoveRight Unit:=wdCharacter, Count:=5, Extend:=wdExtend:
    Selection.TypeBackspace:
    Selection.MoveRight Unit:=wdCharacter, Count:=1:
    Selection.MoveRight Unit:=wdCharacter, Count:=3, Extend:=wdExtend:
    Selection.TypeText Text:="R":
    Selection.MoveRight Unit:=wdCharacter, Count:=8: Selection.TypeBackspace:
    Selection.MoveRight Unit:=wdCharacter, Count:=15: Selection.TypeBackspace:
    Selection.MoveRight Unit:=wdCharacter, Count:=7: Selection.TypeBackspace:
    Selection.MoveRight Unit:=wdCharacter, Count:=6: Selection.TypeBackspace:
    Selection.MoveRight Unit:=wdCharacter, Count:=15: Selection.TypeBackspace:
    Selection.MoveRight Unit:=wdCharacter, Count:=7: Selection.TypeBackspace:
    Selection.MoveRight Unit:=wdCharacter, Count:=6: Selection.TypeBackspace:
    Selection.MoveRight Unit:=wdCharacter, Count:=4: Selection.TypeBackspace:
    Selection.MoveRight Unit:=wdCharacter, Count:=4: Selection.TypeBackspace:
    Selection.MoveRight Unit:=wdCharacter, Count:=3: Selection.TypeBackspace
    Selection.MoveRight Unit:=wdCharacter, Count:=7: Selection.TypeBackspace:
    Selection.MoveRight Unit:=wdCharacter, Count:=13: Selection.TypeBackspace:
    Selection.MoveRight Unit:=wdCharacter, Count:=16: Selection.TypeBackspace:
    Selection.MoveDown Unit:=wdLine, Count:=1:
    Selection.HomeKey Unit:=wdLine
End Sub
I need it to
1. Delete all instances of this character "|" on the line
2. Add the character "R" after the "Z"
3. Delete the whitespace or collapse the text down to the beginning of the line

Example Before:

----|Z| | 1111 |2222222 22|3333 |44444|55555 5|6666 |77777|A |BBB| |CCC | | 111A1111-1111 |


Example After:


ZR 1111 2222222 223333 4444455555 56666 77777A BBB CCC 111A1111-1111


- is for character count of 4 of whitespace

Any help would be greatly appreciated! When running this macro for 1000+ lines it can take a while.

Enjoy,

Tyler
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Character on Single Line Only Every page indents first line one character glennhardy Word 6 02-05-2016 04:05 PM
Delete Character on Single Line Only Use character instead of line for table border dlowrey Word Tables 6 03-09-2015 11:29 AM
Delete Character on Single Line Only macro to add brackets to each line and add single quotes to each word in the line bracketandquotes Word VBA 17 02-16-2015 03:51 PM
first character NOT Alpha numeric or Tilde (~) delete. ksridh Word VBA 5 03-17-2014 12:45 AM
Change single character in PPT to another font macro rtwwpad PowerPoint 1 01-19-2013 05:08 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:50 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