Repopulating Userform from database Checkbox issue

dellehurley

Board Regular
Joined
Sep 26, 2009
Messages
68
Hi,
I'm sure this is simple but I cannot find the answer.
I have a userform which sends data to a database. If the checkbox is checked then it makes the cell bold. This is working well. My issue is with the edit function, this repopulated the userform so changes can be made. I cannot get the checkbox to check if the cell is bold, this is what I have
VBA Code:
If shDB.Range("A2").Font.Bold = True Then
        Me.cboxPriority1.Font.Bold = True
        Else

debug results are
Line 1= false (when it should be true).
Line 2, 1st section =Null and Line 2, 2nd part =True

what am I doing wrong?
Dannielle
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Zot

Well-known Member
Joined
Nov 26, 2020
Messages
1,171
Office Version
  1. 2016
Platform
  1. Windows
I don't see nothing wrong with
If shDB.Range("A2").Font.Bold = True

If the A2 is Bold then the condition should be true, but I thought you want to make cboxPriority1 value to true, not change its caption to Bold? I'm confused. :confused:
 

dellehurley

Board Regular
Joined
Sep 26, 2009
Messages
68
I don't see nothing wrong with
If shDB.Range("A2").Font.Bold = True

If the A2 is Bold then the condition should be true, but I thought you want to make cboxPriority1 value to true, not change its caption to Bold? I'm confused. :confused:
sorry to be confusing.

If text in A2 is Bold, I want the checkbox in the userform to be checked OR if A2 is not bold the checkbox should remain unchecked.
My debug example is referring to an example when the text is bold.
Does that make sense?
 

Zot

Well-known Member
Joined
Nov 26, 2020
Messages
1,171
Office Version
  1. 2016
Platform
  1. Windows
sorry to be confusing.

If text in A2 is Bold, I want the checkbox in the userform to be checked OR if A2 is not bold the checkbox should remain unchecked.
My debug example is referring to an example when the text is bold.
Does that make sense?
If the font in a cell is bold, then to make the checkbox ticked, the syntax should be CheckBox.value=True and False for unchecked
 
Solution

dellehurley

Board Regular
Joined
Sep 26, 2009
Messages
68

ADVERTISEMENT

If the font in a cell is bold, then to make the checkbox ticked, the syntax should be CheckBox.value=True and False for unchecked
 

dellehurley

Board Regular
Joined
Sep 26, 2009
Messages
68
I presume this is what you mean? It didn't work either
VBA Code:
        shDB.Activate
        If shDB.Range("A2").Font.Bold Then
        Me.cboxPriority1.Value = True
        Else
        End If
FYI - shDB is the worksheet. (The code above which I have not included as it is working fine, is working on a different worksheet so I thought that might have been the issue.)
cboxPriority1 is the checkbox
 

Zot

Well-known Member
Joined
Nov 26, 2020
Messages
1,171
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

I presume this is what you mean? It didn't work either
VBA Code:
        shDB.Activate
        If shDB.Range("A2").Font.Bold Then
        Me.cboxPriority1.Value = True
        Else
        End If
FYI - shDB is the worksheet. (The code above which I have not included as it is working fine, is working on a different worksheet so I thought that might have been the issue.)
cboxPriority1 is the checkbox
From your debug, it is not detecting range A2 as bold. You need to find out why, but the code line seems correct to me.
 

dellehurley

Board Regular
Joined
Sep 26, 2009
Messages
68
From your debug, it is not detecting range A2 as bold. You need to find out why, but the code line seems correct to me.
Thanks for helping. At least I know I am basically on track. I will keep digging.
Have a good weekend.
 

dellehurley

Board Regular
Joined
Sep 26, 2009
Messages
68
Thanks for helping. At least I know I am basically on track. I will keep digging.
Have a good weekend.
I fixed an issue with the save function and now the edit function is working! Weird. But it now works. Thanks again for your help.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,902
Messages
5,638,896
Members
417,058
Latest member
BRYCEPIETROWIAK

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top