09-14-2023
04:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-14-2023
04:42 AM
I'm gonna assume you mean a Parts list when you say "list" or "Custom table"
here's my code to find the first parts list in a certain sheet, edit it, go over each cell in a certain row and edit that cell (if necessary)
happy coding!
edit: and I'm already too late, while I was typing there already was a solution posted, I love this community
sub main
call editpartslist
end sub
Sub editpartslist Dim oDrawDoc As DrawingDocument oDrawDoc = ThisDrawing.Document ' Set a reference to the first parts list on the selected sheet. Dim oPartList As PartsList Dim s As String s = "Sheetname:1" On Error GoTo sheetnotfound : oPartList = oDrawDoc.Sheets.Item(s).PartsLists.Item(1) On Error GoTo errorhandler : ' Iterate through the contents of the parts list. Dim i As Long For i = 1 To oPartList.PartsListRows.Count 'look at only the QTY column oCell = oPartList.PartsListRows.Item(i).Item("QTY") 'reset static values If oCell.Static = True Then oCell.Static = False 'do stuff in the cells v = oCell.Value If v.Contains("mm") Or v.Contains(",") oCell.Value = Ceil(Val(Replace(v, ",", "."))) Else End If Next Exit Sub 'errorhandling sheetnotfound : MessageBox.Show("sheet named " & s & " not found while editing partslist") : Exit Sub errorhandler : MessageBox.Show("error while editing partslist") : Exit Sub End Sub