Trying to loop a macro

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

MissHeck73

Thread Starter
Joined
Jan 8, 2019
Messages
1
Hi there.
I am taking 6 digit numbers from an excel sheet, pasting them into word and making some changes to allow me to put them into another system where I can verify some details. Some times I only need to transfer a few numbers, other times I need to transfer up to 1000.

So the data transfer across from Excel to word in the following format

123456
457812
798811
.......and so on

To put it into the last system I need it to be in the following format, which I do in word:

'123456', '457812', ' 798811',......... and so on

So I can create a macro, example below:

Selection.TypeText Text:=" ' "
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" ', "
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=" ' "
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" ', ' "
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" ', ' "
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" ', ' "
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" ', ' "
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" ', ' "
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" ', ' "
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" ', "

How can I loop this to end when the numbers run out? As the data that i need to transfer varies everytime is there an easy way to do this.

Thanking you in advance for your assistance.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top