Return text with text colour
Closed
TheQ1991
TrowaD
- Posts
- 2
- Registration date
- Saturday June 10, 2017
- Status
- Member
- Last seen
- June 10, 2017
TrowaD
- Posts
- 2888
- Registration date
- Sunday September 12, 2010
- Status
- Moderator
- Last seen
- August 16, 2022
Related:
- Return text with text colour
- If cell contains (multiple text criteria) then return (corresponding text criteria) ✓ - Forum - Excel
- Black and white video to colour converter free download - Download
- Resistor colour code calculator download - Download
- How to return on flipkart - Guide
- Excel if cell contains date then return value ✓ - Forum - Office Software
3 replies
Mazzaropi
Jun 10, 2017 at 12:34 PM
- Posts
- 1963
- Registration date
- Monday August 16, 2010
- Status
- Contributor
- Last seen
- April 25, 2022
Jun 10, 2017 at 12:34 PM
TheQ1991, Good afternoon.
I believe you need to use a VBA Excel programation to do what you want.
I believe you need to use a VBA Excel programation to do what you want.
vcoolio
Updated on Jun 10, 2017 at 09:19 PM
- Posts
- 1356
- Registration date
- Thursday July 24, 2014
- Status
- Moderator
- Last seen
- August 11, 2022
Updated on Jun 10, 2017 at 09:19 PM
Hello TheQ1991,
Try the following Worksheet_Change event code placed in the sheet module:-
With the above code, if any cell in Column A is not empty and is formatted to red font, then the value in the adjacent cell in Column B will equal the value in the cell in Column A and in red font. Otherwise, nothing will happen.
To implement the code, right click on the sheet tab, select "view code" from the menu that appears and in the big white field that then appears, paste the above code.
I hope that this helps.
Cheerio,
vcoolio.
P.S. To execute the code:
Once you enter a value in any cell in Column A and then click away (or press enter or down arrow), the code will execute.
Try the following Worksheet_Change event code placed in the sheet module:-
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Then Exit Sub If Target.Value = vbNullString Then Exit Sub If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub If Target.Value <> "" And Target.Font.ColorIndex = 3 Then Target.Offset(, 1).Value = Target.Value Target.Offset(, 1).Font.ColorIndex = 3 End If End Sub
With the above code, if any cell in Column A is not empty and is formatted to red font, then the value in the adjacent cell in Column B will equal the value in the cell in Column A and in red font. Otherwise, nothing will happen.
To implement the code, right click on the sheet tab, select "view code" from the menu that appears and in the big white field that then appears, paste the above code.
I hope that this helps.
Cheerio,
vcoolio.
P.S. To execute the code:
Once you enter a value in any cell in Column A and then click away (or press enter or down arrow), the code will execute.
TrowaD
Jun 12, 2017 at 11:48 AM
- Posts
- 2888
- Registration date
- Sunday September 12, 2010
- Status
- Moderator
- Last seen
- August 16, 2022
Jun 12, 2017 at 11:48 AM
Hi TheQ1991,
Or a more general approach then vcoolio's code:
Whenever there is a value in column A, copy it to the adjacent with all formats applied.
This code needs to be placed in a standard module and run manually, if you choose to use it.
Best regards,
Trowa
Or a more general approach then vcoolio's code:
Sub RunMe() For Each cell In Range("A:A") If cell.Value <> vbNullString Then cell.Copy cell.Offset(0, 1) End If Next cell End Sub
Whenever there is a value in column A, copy it to the adjacent with all formats applied.
This code needs to be placed in a standard module and run manually, if you choose to use it.
Best regards,
Trowa
Jun 10, 2017 at 08:48 PM
Any idea what the VBA code would be?