![]() |
|
|
|
#1
|
||||
|
||||
|
Instead of repeating that block of code each time, you create a sub like:
Code:
Sub Trucks(t As Long)
Dim i As Long, j As Long
For i = 1 To 17
For j = 1 To 10
Me(Chr(64 + j) & i).Enabled = t >= j
Next
Next
End Sub
Code:
Call Trucks(Me.NumTrucks) Code:
Call Trucks(CLng(Me.NumTrucks)) Code:
Dim t As Long If IsNull(Me.NumTrucks) Then t = 0 Else t = Me.NumTrucks End If Call Trucks(t)
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
| Tags |
| forms vba, help a novice, modules |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Standard Module, Class Module and UserForm | jpl | Word VBA | 0 | 03-14-2022 07:20 AM |
| VBA module to Calculate from two tables | shah0101 | Excel Programming | 2 | 01-30-2022 03:10 PM |
| Userform variables in another module | Justice | Word VBA | 1 | 08-26-2021 12:56 AM |
Compile error in Module
|
ksigcajun | Word VBA | 2 | 04-08-2015 06:44 AM |
| AZWizard Module - ?hidden module | pcaldwell | Word | 1 | 08-22-2012 01:19 PM |