View Single Post
 
Old 01-03-2016, 08:31 AM
auditio auditio is offline Windows 7 32bit Office 2013
Novice
 
Join Date: Jan 2016
Posts: 3
auditio is on a distinguished road
Default Search in first column in table

I have many table in a document. I want to search input data (stored in variable with input box) in first column of all the table and paste a variable data (stored in variable with input box) in the third column after text in the same row. I want to do the search & input data for multiple text one after another as many as.


My trying code

Dim FirstName As String
FirstName = InputBox("Type text", "")
Dim LastName As String
LastName = InputBox("Search BD No", "")
Selection.Find.ClearFormatting
With Selection.Find
.Text = LastName
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
Selection.MoveRight Unit:=wdCell
Selection.MoveRight Unit:=wdCell
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=FirstName
End Sub
Reply With Quote