kelly mort
Well-known Member
- Joined
- Apr 10, 2017
- Messages
- 2,169
- Office Version
- 2016
- Platform
- Windows
Hi, I have done some sniffing around to see if I can find solution to my problem. I came close but needed a hand to finish it up for me.
What I want to do here, is to check a given range of controls.
My controls are named "reg1" to say "reg20".
But I want to see if from reg4 to reg8, has any blank. The code I see so far all check for all controls. I need just a range
Can someone pull that string up for me?
Thanks in advance
Code:
[COLOR=#101094][FONT=monospace]Dim[/FONT][/COLOR][COLOR=#303336][FONT=monospace] allEmpty [/FONT][/COLOR][COLOR=#101094][FONT=monospace]As [/FONT][/COLOR][COLOR=#101094][FONT=monospace]Boolean
[/FONT][/COLOR][COLOR=#303336][FONT=monospace]allEmpty [/FONT][/COLOR][COLOR=#303336][FONT=monospace]=[/FONT][/COLOR][COLOR=#7D2727][FONT=monospace]True
[/FONT][/COLOR][COLOR=#101094][FONT=monospace]For [/FONT][/COLOR][COLOR=#101094][FONT=monospace]Each[/FONT][/COLOR][COLOR=#303336][FONT=monospace] crtl [/FONT][/COLOR][COLOR=#101094][FONT=monospace]In [/FONT][/COLOR][COLOR=#101094][FONT=monospace]Me[/FONT][/COLOR][COLOR=#303336][FONT=monospace].[/FONT][/COLOR][COLOR=#303336][FONT=monospace]Controls
[/FONT][/COLOR][COLOR=#101094][FONT=monospace] If[/FONT][/COLOR][COLOR=#303336][FONT=monospace] crtl[/FONT][/COLOR][COLOR=#303336][FONT=monospace].[/FONT][/COLOR][COLOR=#303336][FONT=monospace]Name [/FONT][/COLOR][COLOR=#101094][FONT=monospace]Like [/FONT][/COLOR][COLOR=#7D2727][FONT=monospace]"txtM*" [/FONT][/COLOR][COLOR=#101094][FONT=monospace]Then
[/FONT][/COLOR][COLOR=#101094][FONT=monospace] If[/FONT][/COLOR][COLOR=#303336][FONT=monospace] Trim[/FONT][/COLOR][COLOR=#303336][FONT=monospace]([/FONT][/COLOR][COLOR=#303336][FONT=monospace]crtl[/FONT][/COLOR][COLOR=#303336][FONT=monospace].[/FONT][/COLOR][COLOR=#303336][FONT=monospace]Value[/FONT][/COLOR][COLOR=#303336][FONT=monospace]) [/FONT][/COLOR][COLOR=#303336][FONT=monospace]<> [/FONT][/COLOR][COLOR=#7D2727][FONT=monospace]"" [/FONT][/COLOR][COLOR=#101094][FONT=monospace]Then[/FONT][/COLOR][COLOR=#303336][FONT=monospace]
allEmpty [/FONT][/COLOR][COLOR=#303336][FONT=monospace]=[/FONT][/COLOR][COLOR=#7D2727][FONT=monospace]False
[/FONT][/COLOR][COLOR=#101094][FONT=monospace] Exit [/FONT][/COLOR][COLOR=#101094][FONT=monospace]For
[/FONT][/COLOR][COLOR=#101094][FONT=monospace] End [/FONT][/COLOR][COLOR=#101094][FONT=monospace]If
[/FONT][/COLOR][COLOR=#101094][FONT=monospace] End [/FONT][/COLOR][COLOR=#101094][FONT=monospace]If
[/FONT][/COLOR][COLOR=#101094][FONT=monospace]Next
[/FONT][/COLOR][COLOR=#101094][FONT=monospace]If[/FONT][/COLOR][COLOR=#303336][FONT=monospace] allEmpty [/FONT][/COLOR][COLOR=#101094][FONT=monospace]Then[/FONT][/COLOR][COLOR=#303336][FONT=monospace]
MsgBox [/FONT][/COLOR][COLOR=#7D2727][FONT=monospace]"dont forget .... blablabla"
[/FONT][/COLOR][COLOR=#101094][FONT=monospace] Exit [/FONT][/COLOR][COLOR=#101094][FONT=monospace]Sub
[/FONT][/COLOR][COLOR=#101094][FONT=monospace]End [/FONT][/COLOR][COLOR=#101094][FONT=monospace]If[/FONT][/COLOR]
What I want to do here, is to check a given range of controls.
My controls are named "reg1" to say "reg20".
But I want to see if from reg4 to reg8, has any blank. The code I see so far all check for all controls. I need just a range
Can someone pull that string up for me?
Thanks in advance