how to connect user form text box color formatting to cell formatting in excel VBA that I have already formatted

Tifa

New Member
Joined
Dec 15, 2020
Messages
19
Office Version
  1. 2019
Platform
  1. Windows
how to connect user form text box color formatting to cell formatting in excel VBA that I have already formatted

when I use this

Me.Tb_Acc.BackColor = Range("E2").Interior.Color

it shows only the fill color of the cell but the color changes according to the formatting the Text box color stays as it is
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
24,068
When that line runs the color of the text box will be changed and won't change again until a similar line runs.
Changing a cell's color does not trigger any events, so you cannot automatically have a textbox follow a cells back color.
 

Tifa

New Member
Joined
Dec 15, 2020
Messages
19
Office Version
  1. 2019
Platform
  1. Windows

ADVERTISEMENT

The problem is it follows only the color fill and not the conditional formatting colors

what is the code needed to make a text box color be similar to the conditional formating colors of the cell

how could I achieve that? what is the code please?
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
24,068
For a one time matching, you could look at the DisplayFormat property of the cell

VBA Code:
Me.Tb_Acc.BackColor = Range("E2").DisplayFormat.Interior.Color
 
Solution

Tifa

New Member
Joined
Dec 15, 2020
Messages
19
Office Version
  1. 2019
Platform
  1. Windows
For a one time matching, you could look at the DisplayFormat property of the cell

VBA Code:
Me.Tb_Acc.BackColor = Range("E2").DisplayFormat.Interior.Color
Thanks a lot that worked
 

Forum statistics

Threads
1,141,061
Messages
5,704,043
Members
421,324
Latest member
Devo182

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