Excel VBA Colour .Fill.ForeColor

Ray_Mnd

New Member
Joined
Mar 20, 2024
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hey to all.
i am new in this area and have a problem.
i need the formated color from $a (for example) in a programmed field.
i can do:
.Fill.ForeColor.RGB = RGB(255, 255, 0)
but the field is only yellow. this is what i found in my vba.
can anyone say me what i have to type so that the color from formated $a is taken in the new field?

1710917453018.png

color from $A


this is my code with yellow color:
With Worksheets(PMpav).Shapes.AddShape(msoShapeRectangle, xpav(numtypeop%, codop, nbmvt%), ypav(numtypeop%, codop, nbmvt%), durée_mvt(numtypeop%, codop, nbmvt%) * Echellex, hauteur_tâche%)
.TextFrame.Characters.Text = Worksheets(PMdon).Cells(rm, cl_tâche%).Value
.Fill.ForeColor.RGB = RGB(255, 255, 0)
'Text zur Anzeige im Haupblock Aufgabe
.TextFrame.Characters.Font.Bold = True
.TextFrame.Characters.Font.Size = 10




maybe anyone can help me,
Greetz
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Re: "color from $a". What is "$a"?
What is a "programmed field" Would that be Range("A4:E11")?
 
Upvote 0
$A is the hole column A.
The Text from Column A goes in a field on the second sheet.

1710919055616.png

like this with the yellow color, but i need the color from column a in the field which is now yellow
 
Upvote 0
Code:
Sub Vielleicht_So()
Sheets("Sheet1").Range("A1:A15").Copy
Sheets("Sheet2").Range("A1").PasteSpecial Paste:=xlPasteFormats
End Sub

Code:
Sub Oder_So()
Sheets("Sheet2").Range("A1:A15").Interior.Color = Sheets("Sheet1").Range("A1:A15").Interior.Color
End Sub
 
Upvote 0
Code:
Sub Vielleicht_So()
Sheets("Sheet1").Range("A1:A15").Copy
Sheets("Sheet2").Range("A1").PasteSpecial Paste:=xlPasteFormats
End Sub

Code:
Sub Oder_So()
Sheets("Sheet2").Range("A1:A15").Interior.Color = Sheets("Sheet1").Range("A1:A15").Interior.Color
End Sub
Ok, thx... I will try and report 👍🏻
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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