bsward
07-18-2011, 08:09 AM
Hi,
This is my first post to these forums and VBA and thus apologise for posing what is probably a silly question.
I have a lengthy document which contains database output in an odd format. All lines take the form:
NUMBER TAG text
NUMBER TAG text
I want to write a macro which, for every line where the Tag is "start", to cut the text between that Tag and the next number which appears in a document. I then want to paste that text to the end of the line, exactly three lines up.
I have a basic structure for this but I have no real idea how to set the limit for the selection or even to append text three lines up. Any help, greatly appreciated.
Dim Tag as String
Tag = "X"
Selection.Find.ClearFormatting
With Selection.Find
.Text=Tag
.Forward=True
.MatchCase=True
End With
Now, how do I then make it select the required string after the Tag?
Many, many thanks,
Ben
Ben
This is my first post to these forums and VBA and thus apologise for posing what is probably a silly question.
I have a lengthy document which contains database output in an odd format. All lines take the form:
NUMBER TAG text
NUMBER TAG text
I want to write a macro which, for every line where the Tag is "start", to cut the text between that Tag and the next number which appears in a document. I then want to paste that text to the end of the line, exactly three lines up.
I have a basic structure for this but I have no real idea how to set the limit for the selection or even to append text three lines up. Any help, greatly appreciated.
Dim Tag as String
Tag = "X"
Selection.Find.ClearFormatting
With Selection.Find
.Text=Tag
.Forward=True
.MatchCase=True
End With
Now, how do I then make it select the required string after the Tag?
Many, many thanks,
Ben
Ben