<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to change or add the table cell values in a drawing using VBA? in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10019311#M3715</link>
    <description>&lt;P&gt;I have a table in my drawing and I want to change or add the cell values using VBA.&lt;/P&gt;&lt;P&gt;The following is my requirement:&lt;/P&gt;&lt;P&gt;Existing "A1 cell" value: XXXXX&lt;/P&gt;&lt;P&gt;New "A1 cell" value needed: YYYYY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me with the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohammed Shuaib&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jan 2021 12:34:40 GMT</pubDate>
    <dc:creator>shuaib_cad</dc:creator>
    <dc:date>2021-01-21T12:34:40Z</dc:date>
    <item>
      <title>How to change or add the table cell values in a drawing using VBA?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10019311#M3715</link>
      <description>&lt;P&gt;I have a table in my drawing and I want to change or add the cell values using VBA.&lt;/P&gt;&lt;P&gt;The following is my requirement:&lt;/P&gt;&lt;P&gt;Existing "A1 cell" value: XXXXX&lt;/P&gt;&lt;P&gt;New "A1 cell" value needed: YYYYY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me with the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohammed Shuaib&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 12:34:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10019311#M3715</guid>
      <dc:creator>shuaib_cad</dc:creator>
      <dc:date>2021-01-21T12:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to change or add the table cell values in a drawing using VBA?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10019779#M3716</link>
      <description>&lt;P&gt;First of all you have to point to your table object inside the drawing:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;For Each Object in thisdrawing.modelspace
  If Object.ObjectName="AcadTable" then
    Set MyTable=Object
  end if
Next
.... Apply here the example for cells manipulation ... &lt;/LI-CODE&gt;&lt;P&gt;Later you can use the online help related to Cells managing inside the drawing, removing AddTable.&lt;/P&gt;&lt;P&gt;Or If you want to add a Table and manipulate the cells use the entire code below coming from online help.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sub Example_CellManipulation()
    ' This example adds a table in model space and sets and gets a column name

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.modelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Dim cName As String
   ' Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30) ' here you add Table
    
    Call MyTable.SetCellDataType(2, 2, acLong, acUnitDistance)
    Call MyTable.SetCellFormat(1, 3, "testFormat")
    Call MyTable.SetCellState(4, 3, acCellStateContentLocked)
    Call MyTable.SetCellValue(1, 4, 5)
    
    MsgBox MyTable.GetCellValue(1, 4) &amp;amp; " is the test cell's value "

    ZoomExtents
    
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 15:11:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10019779#M3716</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-01-21T15:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to change or add the table cell values in a drawing using VBA?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10019843#M3717</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Grobnik!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your response.&lt;/P&gt;&lt;P&gt;I already have a table in my drawing which has some values in each cell. I want to replace those values with new ones.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;Existing "A1 cell" value: XXXXX&lt;/P&gt;&lt;P&gt;New "A1 cell" value needed: YYYYY&lt;/P&gt;&lt;P&gt;Existing "A2 cell" value: AAAAA&lt;/P&gt;&lt;P&gt;New "A1 cell" value needed: BBBBB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help with the code to exactly match my requirement as I am new to AutoCAD VBA.&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohammed Shuaib&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 15:25:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10019843#M3717</guid>
      <dc:creator>shuaib_cad</dc:creator>
      <dc:date>2021-01-21T15:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to change or add the table cell values in a drawing using VBA?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10019887#M3718</link>
      <description>&lt;P&gt;Here&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub ChangeTableCell()
For Each Object in thisdrawing.modelspace
  If Object.ObjectName="AcadTable" then
    Set MyTable=Object
    exit for
  end if
Next
'object.SetCellValue row, col, val &amp;lt;----Function for modify cell value
    ' Object is the Table object in your drawing,
    ' row is the Table row, 
    ' col is the Table column,
    ' val is the value.
    Call MyTable.SetCellValue(1, 1, "YYYY") 
    Call MyTable.SetCellValue(2, 1, "ZZZZ")
end sub&lt;/LI-CODE&gt;&lt;P&gt;If your Table have an heading row, the number of first row could change, and shifted by 1 unit.&lt;/P&gt;&lt;P&gt;Try an let us know.&lt;/P&gt;&lt;P&gt;As second issue I'm suggesting you to read some ebook also available on line for free about Autocad VBA.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 15:39:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10019887#M3718</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-01-21T15:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to change or add the table cell values in a drawing using VBA?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020196#M3719</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;Grobnik&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;The code which you have given is not working for me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Tried changing the rows &amp;amp; columns numbers also. Please try and give me a different code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Mohammed Shuaib&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 17:09:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020196#M3719</guid>
      <dc:creator>shuaib_cad</dc:creator>
      <dc:date>2021-01-21T17:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to change or add the table cell values in a drawing using VBA?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020229#M3720</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here the code,&lt;/P&gt;&lt;P&gt;In any case when you say "&lt;SPAN&gt;&amp;nbsp;is not working for me" usually it's better to clarify where the code hangs, or message error showed, this can help the code debug, for you and for the other.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub ChangeTableCell()
For Each Object In ThisDrawing.ModelSpace
  If Object.ObjectName = "AcDbTable" Then
    Set MyTable = Object
    Exit For
  End If
Next
'object.SetCellValue row, col, val &amp;lt;----Function for modify cell value
    ' Object is the Table object in your drawing,
    ' row is the Table row,
    ' col is the Table column,
    ' val is the value.
    Call MyTable.SetCellValue(1, 1, "YYYY")
    Call MyTable.SetCellValue(2, 1, "ZZZZ")
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 17:21:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020229#M3720</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-01-21T17:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to change or add the table cell values in a drawing using VBA?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020331#M3721</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;Grobnik&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;The code which you have given is the same as the previous one. As I already told you this code isn't working for me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;There is no error as such when I try to run it. It make the drawing and table unchanged.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Mohammed Shuaib&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 18:01:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020331#M3721</guid>
      <dc:creator>shuaib_cad</dc:creator>
      <dc:date>2021-01-21T18:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to change or add the table cell values in a drawing using VBA?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020337#M3722</link>
      <description>&lt;P&gt;Can anyone help me with the VBA code please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohammed Shuaib&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 18:02:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020337#M3722</guid>
      <dc:creator>shuaib_cad</dc:creator>
      <dc:date>2021-01-21T18:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to change or add the table cell values in a drawing using VBA?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020347#M3723</link>
      <description>The code it's different from previous one check in deep before to judge.&lt;BR /&gt;The test of type of object it's differents.&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Jan 2021 18:05:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020347#M3723</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-01-21T18:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to change or add the table cell values in a drawing using VBA?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020360#M3724</link>
      <description>&lt;P&gt;How many tables do you have in the drawing? Which is the cad version do you have ?&lt;/P&gt;&lt;P&gt;Run step by step the code, debug the object name variable inside the for next loop.&lt;/P&gt;&lt;P&gt;Share the drawing.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 18:11:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020360#M3724</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-01-21T18:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to change or add the table cell values in a drawing using VBA?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020405#M3725</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;Grobnik&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Sorry I didn't notice that change. But still it isn't working for me. The code passes through, without affecting the table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Is there any code to find and replace the cell values?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Mohammed Shuaib&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 18:28:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020405#M3725</guid>
      <dc:creator>shuaib_cad</dc:creator>
      <dc:date>2021-01-21T18:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to change or add the table cell values in a drawing using VBA?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020530#M3726</link>
      <description>&lt;P&gt;The code is that I showed you.&lt;BR /&gt;On my Autocad it's working fine.&lt;BR /&gt;Did you been able to debug step by step the variable "Object.ObjectName" ?&lt;BR /&gt;&lt;BR /&gt;In editing mode highlight the above part of code, click right mouse button&lt;BR /&gt;on it, select ADD WATCH, then on menu click on "view" and "Watch Window".&lt;BR /&gt;Run the code step by step with F8 function key, and look at watch windows to&lt;BR /&gt;Object.ObjectName value, check if object name will contain "Table" word,&lt;BR /&gt;could be AcDbTable, or AcadTable value.&lt;BR /&gt;On the opposite table in the drawing is not a table but it's another type of&lt;BR /&gt;object, perhaps a block or an ole object such as excel sheet imported.&lt;BR /&gt;Share the DWG.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 19:17:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10020530#M3726</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-01-21T19:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to change or add the table cell values in a drawing using VBA?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10021395#M3727</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;Grobnik&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Yes, its working fine now. Had to remove the excel data reference from the table in my template drawing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Now its perfect. Thanks to you!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Mohammed Shuaib&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 03:40:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10021395#M3727</guid>
      <dc:creator>shuaib_cad</dc:creator>
      <dc:date>2021-01-22T03:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to change or add the table cell values in a drawing using VBA?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10021656#M3728</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/923732"&gt;@shuaib_cad&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm happy that you solved your issue, but it seems that you are in a hurry to do things and judge too quickly the support that is provided to you, without trying to understand why certain procedures in VBA, even if you are at the beginning (from what I heard).&lt;/P&gt;&lt;P&gt;When I pointed you to the second version of the code in order to change the contents of a table cell, you immediately sought support elsewhere, asking the forum for help again, instead of understanding why it wasn't working properly. The problem was actually within your drawing.&lt;/P&gt;&lt;P&gt;This not the correct approach.&lt;/P&gt;&lt;P&gt;Bye&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 07:11:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10021656#M3728</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2021-01-22T07:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to change or add the table cell values in a drawing using VBA?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10022222#M3729</link>
      <description>&lt;P&gt;Thanks for your support!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohammed Shuaib&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 11:32:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/how-to-change-or-add-the-table-cell-values-in-a-drawing-using/m-p/10022222#M3729</guid>
      <dc:creator>shuaib_cad</dc:creator>
      <dc:date>2021-01-22T11:32:16Z</dc:date>
    </item>
  </channel>
</rss>

