Hello Pros,
I've been searching for 5 hours, and still can't find a solution, so I need Pro Help!
I have a great macro where I tell which 2 sets of cells/columns to select as a range.
It does a fantastic job, then I use a Find and Replace macro to make a number of changes, and it doesn't touch other columns in the same table or other columns in the previous tables or forward tables. It doesn't even touch paragraphes
The only 2 thing, is that is it block at tables(1)
and I wish to have InputBox for variable set of cells. I've tried to put xText# but now it gives me error message and I can't figure out why.
The other macro, gives me the table index number. I'm trying to incorporate it togerther. Can't figure out how.
Here are the two macros:
Macro#1
Get table index number:
Code:
Sub Find_Table_Index_number()
MsgBox ActiveDocument.range(0, Selection.Tables(1).range.End).Tables.Count
End Sub
Macro#2
Code:
Sub TEST2_TBL_FR1_Selection_of_cell()
'To select a range of cells within a table, declare a Range variable, assign to it the cells you want to select, and then select the range
'Cell(1= first row /, 1 = 1st Column ----to Range End, Cell (11 = 11th Row /, 5 = 5th Column)
Dim oTbl As Table
Dim myCells As range
Dim sText1 As Integer 'Table Index Range Number to Select
Dim sText2 As Integer 'Table First Row to Start the Table Range Selection
Dim sText3 As Integer 'Table First Column to End the Table Range Selection
Dim sText4 As Integer 'Table Last Column to End the Table Range Selection
Set oTbl = Selection.Tables(1)
With ActiveDocument
sText1 = InputBox("Enter the desired Table Number to Select")
sText2 = InputBox("Enter the desired Table First Row to Start the Table Selection")
sText3 = InputBox("Enter the desired Table First Column to Start the Table Selection")
sText4 = InputBox("Enter the desired Table Last Column to End the Table Selection")
'Set myCells = .range(Start:=.Tables(1).Cell(1, 2).range.Start, _
End:=.Tables(1).Cell(99, 3).range.End)
Set myCells = .range(Start:=.Tables("sText1").Cell("sText2", "sText3").range.Start, _
End:=.Tables(1).Cell(99, "sText4").range.End)
myCells.Select
End With
Set myCells = Nothing: Set oTbl = Nothing
On Error GoTo 0
End Sub
Any advice how to fix this, I would be sooooooooooo grateful.
Thanks in advance, pro's.
Cendrinne