S
Sorcerer13
I have a Userform with 15 Checkboxes on it, which is in development
Every tiome the User decides to change the bits at the top of the for
(the Company logo, the headings etc.), I need to shift the checkboxes u
or down so the form looks reasonable.
I decided to knock together a quick VBA process to adjust the positio
of the Checkboxes (see below). I execute this from a "free standing
Module ('cos it's just for me to use). It works perfectly, except tha
if I double click on the CBForm, the Checkboxes are still in thei
original positions (even though the "CBForm.Show" shows them in thei
"new" positions etc.). Presumably I'm missing a "save" or "update
option at the end of the loop, but I can't find one.
Can anyone help?
Code
-------------------
Sub CBSetPos()
Const cintHeight As Integer = 15
Const cintTop As Integer = 50
Dim intPtr As Integer
Dim intOldTop As Integer
Dim intTop As Integer
Dim strCBName As String
intTop = cintTop - cintHeight
For intPtr = 1 To 15
intTop = intTop + cintHeight
strCBName = "Checkbox" & intPtr
intOldTop = CBForm.Controls(strCBName).Top
CBForm.Controls(strCBName).Top = intTop
CBForm.Controls(strCBName).Caption = strCBName & " " & intTop
Debug.Print strCBName & ":" & "Was " & intOldTop & " now " & intTop
Next intPtr
CBForm.Show
End Su
Every tiome the User decides to change the bits at the top of the for
(the Company logo, the headings etc.), I need to shift the checkboxes u
or down so the form looks reasonable.
I decided to knock together a quick VBA process to adjust the positio
of the Checkboxes (see below). I execute this from a "free standing
Module ('cos it's just for me to use). It works perfectly, except tha
if I double click on the CBForm, the Checkboxes are still in thei
original positions (even though the "CBForm.Show" shows them in thei
"new" positions etc.). Presumably I'm missing a "save" or "update
option at the end of the loop, but I can't find one.
Can anyone help?
Code
-------------------
Sub CBSetPos()
Const cintHeight As Integer = 15
Const cintTop As Integer = 50
Dim intPtr As Integer
Dim intOldTop As Integer
Dim intTop As Integer
Dim strCBName As String
intTop = cintTop - cintHeight
For intPtr = 1 To 15
intTop = intTop + cintHeight
strCBName = "Checkbox" & intPtr
intOldTop = CBForm.Controls(strCBName).Top
CBForm.Controls(strCBName).Top = intTop
CBForm.Controls(strCBName).Caption = strCBName & " " & intTop
Debug.Print strCBName & ":" & "Was " & intOldTop & " now " & intTop
Next intPtr
CBForm.Show
End Su