Iterating through all tables in word VBA
First time here & I'm relatively new at vba. I'm trying to iterate through all the tables in a word document to update price list items that are always in column 3 of each table (two tables in this case). The iteration happens, but the single value in the second table doesn't show up in my output check message box. Here is the code I have so far and I really appreciate any help or hints:
Dim oTbl As Table Dim Percent As Long Dim intNumber As Long Dim i As Long Set oTbl = ActiveDocument.Tables(1) With ActiveDocument.Tables For i = 1 To .Count 'MsgBox (i) '--------- output check For Each oRow In oTbl.Rows Set oCell = oRow.Cells(3) intNumber = Val(oCell.Range.Text) 'MsgBox (intNumber) '--------- output check Percent = InputBox("Enter the percentage to increase pricing", "Percent Increase", 0) intNumber = intNumber + (intNumber * (Percent / 100)) 'MsgBox (intNumber) '--------- output check oCell.Range.Text = intNumber 'MsgBox oCell.Range.Text '--------- output check Next Next End With End Sub Back to top |
All times are GMT - 8 Hours |