Repopulating Userform from database Checkbox issue

dellehurley

Board Regular
Joined
Sep 26, 2009
Messages
171
Office Version
  1. 365
Platform
  1. Windows
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

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
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:
 
Upvote 0
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?
 
Upvote 0
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
 
Upvote 0
Solution
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
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,967
Messages
6,122,503
Members
449,090
Latest member
RandomExceller01

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
Back
Top