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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
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.
 
Upvote 0
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?
 
Upvote 0
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
 
Upvote 0
Solution

Forum statistics

Threads
1,214,642
Messages
6,120,700
Members
448,979
Latest member
DET4492

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