Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 11-22-2019, 09:09 AM
geojf3 geojf3 is offline Auto fill based on previous entry Windows 10 Auto fill based on previous entry Office 2010
Novice
Auto fill based on previous entry
 
Join Date: Nov 2019
Posts: 6
geojf3 is on a distinguished road
Default

I created a macro with the following code to read through the first table and if there is an X, place data in the second table.


What I do not know how to do is have it run for all the documents that need to be changed/updated.


Code:
Dim strClean As String
Dim oTbl As Table
Dim Row As Integer
Dim Col As Integer
Dim strCellText As String

Set oTbl = ActiveDocument.Tables(3)

 For Row = 1 To oTbl.Rows.Count
        For Col = 1 To oTbl.Columns.Count
            strCellText = oTbl.Cell(Row, Col).Range.Text
            strClean = Mid(strCellText, 1, Len(strCellText) - 2)
            If Trim(strClean) = "X" Then
               With ActiveDocument.Tables(4).Cell(2, 3).Range
               .Text = "nailed it"
               End With
            End If
        Next
    Next
Reply With Quote
 

Tags
2010, auto populate

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto fill based on previous entry Form auto fill based on a different field value. stct Word 31 05-02-2024 04:48 PM
Auto fill drops down using VBA code based on selection AgilityJS Word VBA 5 11-03-2015 07:50 PM
How to remove auto type entry ep2002 Excel 19 11-06-2013 08:48 AM
Auto Entry Names etc Into Document simonyglog Word 2 07-08-2010 10:22 AM
Auto fill based on previous entry Sequentail Number Each Row Based On Another Column Entry KramerJ Excel 3 05-07-2009 11:35 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:27 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft