![]() |
|
#1
|
|||
|
|||
|
Hi, I have created a basic form that will be used to fill out machine problems, The amount of information/Items i need will depend on how well the machine was built, a good machine may only have 3 issues where a bad machine could have over 20. What i want is to be able to add additional blocks/group of cells as the previous ones fill up. It will make more sense if you look at the attached document. What i would also like is when a new block of cells are added it will increment on the Item Number. Also, is there a way in to change the font colour if a tick box is selected. Hope all this makes sense. |
|
#2
|
||||
|
||||
|
The simplest method of adding additional blocks/group of cells when the previous ones fill up is to create a custom quick part consisting of a complete block/group and insert that.
As for changing colours when a checkbox is checked, you can add the following code to your document's 'ThisDocument' code module: Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim Rng As Range
With ContentControl
If .Type <> wdContentControlCheckBox Then Exit Sub
With .Range
If .Information(wdWithInTable) = False Then Exit Sub
If .Rows(1).Cells.Count = .Cells(1).ColumnIndex Then Exit Sub
If ContentControl.Checked = True Then
.Rows(1).Cells(.Cells(1).ColumnIndex + 1).Range.Font.Color = wdColorRed
Else
.Rows(1).Cells(.Cells(1).ColumnIndex + 1).Range.Font.Color = wdColorAutomatic
End If
End With
End With
End Sub
Note: You will need to re-save your document in the .docm format to retain the macro.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How to make cells shift down automatically
|
iffy | Excel | 7 | 04-15-2013 08:06 AM |
Automatically add something to cells
|
SavvyEd | Excel | 2 | 07-31-2012 08:54 PM |
| Automatically change the value of one cell so that two other cells become equal | matthew544 | Excel | 5 | 09-18-2011 08:56 AM |
| How can I change the colors of cells automatically based on Job Completion? | Learner7 | Excel | 0 | 07-06-2010 10:47 PM |
| format cells to automatically place quotes around text | dirtleg | Excel | 1 | 09-16-2008 01:52 PM |