Loop through sheet set

Loop through sheet set

Anonymous
Not applicable
613 Views
2 Replies
Message 1 of 3

Loop through sheet set

Anonymous
Not applicable

I have around 200 drawings in subset of a sheet set. Half of the sheet numbers are just numbers and the other half are numbers with a D at the end. I want to add a dash before the D if the sheet number has one. Basically, I need to make this

1
1D
2
2D
3
3D

look like this

1
1-D
2
2-D
3
3-D

I think only VBA has access to edit the sheetset so a lisp can't be used. I can write the loop to work in excel VBA, but I'm having trouble in autoCAD VBA because I don't know how to call out all of the sheets in the subset or the property that needs to be changed (the sheet number).

0 Likes
614 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

I'm not sure if this will help at all but this is what I wrote that works in excel VBA. The lines in red are what need to be changed.

 

 

Public Sub Demolition()


 For Each cell In Range("E6:E13") 'Need to define every sheet in a subset
 
 If Right(cell.Text, 1) = "D" Then 'Need to call out the sheet number property
 
 cell.Value = Left(cell.Text, Len(cell.Text) - 1) & "-D" 'Same as above
 
 End If
 
 Next cell
 
 
End Sub

 

0 Likes
Message 3 of 3

Jeff_M
Consultant
Consultant

This old Autodesk University class should give you the infomation you need.

Jeff_M, also a frequent Swamper
EESignature
0 Likes