replicate index match in VBA to maintain individual font formats within a cell.

brucecanny

New Member
Joined
Oct 27, 2017
Messages
3
First let me acknowledge that each component of my question has been covered however I think this is unique, and probably simpler as I only want to return the value AND format of one cell, but it is from an closed external file. I'm new to VBA and the answers to each component of my question all seem to be very compicated in some way (array's, copying entire sheets or columns...). The INDEX/MATCH works fine however the source fonts have different colors within the same cell and INDEX/MATCH only returns the Value.. I hope this is enough information. Here is my Index Match.

=INDEX('[Race-9-Ball-Balls.xlsx]Race'!$B$2:$Q$17,MATCH(N8,'[Race-9-Ball-Balls.xlsx]Race'!$A$2:$A$17,1),MATCH(N9,'[Race-9-Ball-Balls.xlsx]Race'!$B$1:$Q$1,1))

This is what it returns: [TABLE="width: 54"]
<tbody>[TR]
[TD="class: xl66, width: 54"]❺❼[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 35"]
<tbody>[TR]
[TD="class: xl64, width: 35"]
But I want:
[TABLE="width: 54"]
<tbody>[TR]
[TD="class: xl66, width: 54"][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
I realized I should have provided more detail. This is a pool tournament spreadsheet and the "Race" is shaded green. You can see the un-formatted output in the screenshot along with a screenshot of the source file.

open
open
open
Source:

[TABLE="width: 332"]
<colgroup><col><col span="5"></colgroup><tbody>[TR]
[TD]Handicap[/TD]
[TD]11[/TD]
[TD]12[/TD]
[TD]13[/TD]
[TD]Pro[/TD]
[TD]SmP[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Result:

[TABLE="width: 198"]
<colgroup><col><col span="2"><col><col></colgroup><tbody>[TR]
[TD] [/TD]
[TD]M[/TD]
[TD]N[/TD]
[TD]O[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD="colspan: 2"]❹❼[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]3[/TD]
[TD]1[/TD]
[TD]Nok[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]10[/TD]
[TD]Pro[/TD]
[TD]Nikeel[/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 198"]
<colgroup><col><col span="2"><col><col></colgroup><tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Desired result:
[TABLE="width: 198"]
<colgroup><col><col span="2"><col><col></colgroup><tbody>[TR]
[TD] [/TD]
[TD]M[/TD]
[TD]N[/TD]
[TD]O[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD="colspan: 2"][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]3[/TD]
[TD]1[/TD]
[TD]Nok[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]10[/TD]
[TD]Pro[/TD]
[TD]Nikeel[/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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