How can I get the exact position of bold words in a cell?












0















I have two cells (let"s say A1 and B1) with same content, but not same formatting (borders, size, background, etc.)



I need to have the same bold words in the two cells.
But I don't want to change any other formattings of A1 and B1



I've made a loop on the text in A1 in order to detect if each letter is in bold or not:




For i = 1 To Len([A1])



If [A1].Characters(i, 1).Font.Bold = True Then [B1].Characters(i,
1).Font.Bold = True



Next i




When the length of the text in A1 exceeds 200 letters, this loop takes several seconds to execute, and I need to optimize it.



My idea is to transfer the "[A1].characters" object in a variable, in order to check faster whether each letter of A1 is in bold or not.



So I create the object [A1].characters:




set chr=[A1].characters




How can I get the property "bold/not bold" of each letter of the text?



(I'vee been looking for a way to build an array which dimension is the number of letters of A1, with 1's for bold letters and 0's for not bold letters, but I can't find it)



Thanks in advance for your help.










share|improve this question























  • A faster way would be to get the format of cell B1 you want to keep, copy cell A1 into B1, then apply the original formatting back on B1.

    – cybernetic.nomad
    Jan 16 at 17:35











  • Would it really be faster? keeping copy of all formattings, implies keeping copy of all borders formatting, background formatting, poloce formatting, alignment formatting, etc (Big macro!)

    – pruvieros
    Jan 17 at 5:46













  • Please edit your question to give us an example of what you have and what the expected result is. This may be useful to help creating a good example.

    – cybernetic.nomad
    Jan 17 at 12:45


















0















I have two cells (let"s say A1 and B1) with same content, but not same formatting (borders, size, background, etc.)



I need to have the same bold words in the two cells.
But I don't want to change any other formattings of A1 and B1



I've made a loop on the text in A1 in order to detect if each letter is in bold or not:




For i = 1 To Len([A1])



If [A1].Characters(i, 1).Font.Bold = True Then [B1].Characters(i,
1).Font.Bold = True



Next i




When the length of the text in A1 exceeds 200 letters, this loop takes several seconds to execute, and I need to optimize it.



My idea is to transfer the "[A1].characters" object in a variable, in order to check faster whether each letter of A1 is in bold or not.



So I create the object [A1].characters:




set chr=[A1].characters




How can I get the property "bold/not bold" of each letter of the text?



(I'vee been looking for a way to build an array which dimension is the number of letters of A1, with 1's for bold letters and 0's for not bold letters, but I can't find it)



Thanks in advance for your help.










share|improve this question























  • A faster way would be to get the format of cell B1 you want to keep, copy cell A1 into B1, then apply the original formatting back on B1.

    – cybernetic.nomad
    Jan 16 at 17:35











  • Would it really be faster? keeping copy of all formattings, implies keeping copy of all borders formatting, background formatting, poloce formatting, alignment formatting, etc (Big macro!)

    – pruvieros
    Jan 17 at 5:46













  • Please edit your question to give us an example of what you have and what the expected result is. This may be useful to help creating a good example.

    – cybernetic.nomad
    Jan 17 at 12:45
















0












0








0








I have two cells (let"s say A1 and B1) with same content, but not same formatting (borders, size, background, etc.)



I need to have the same bold words in the two cells.
But I don't want to change any other formattings of A1 and B1



I've made a loop on the text in A1 in order to detect if each letter is in bold or not:




For i = 1 To Len([A1])



If [A1].Characters(i, 1).Font.Bold = True Then [B1].Characters(i,
1).Font.Bold = True



Next i




When the length of the text in A1 exceeds 200 letters, this loop takes several seconds to execute, and I need to optimize it.



My idea is to transfer the "[A1].characters" object in a variable, in order to check faster whether each letter of A1 is in bold or not.



So I create the object [A1].characters:




set chr=[A1].characters




How can I get the property "bold/not bold" of each letter of the text?



(I'vee been looking for a way to build an array which dimension is the number of letters of A1, with 1's for bold letters and 0's for not bold letters, but I can't find it)



Thanks in advance for your help.










share|improve this question














I have two cells (let"s say A1 and B1) with same content, but not same formatting (borders, size, background, etc.)



I need to have the same bold words in the two cells.
But I don't want to change any other formattings of A1 and B1



I've made a loop on the text in A1 in order to detect if each letter is in bold or not:




For i = 1 To Len([A1])



If [A1].Characters(i, 1).Font.Bold = True Then [B1].Characters(i,
1).Font.Bold = True



Next i




When the length of the text in A1 exceeds 200 letters, this loop takes several seconds to execute, and I need to optimize it.



My idea is to transfer the "[A1].characters" object in a variable, in order to check faster whether each letter of A1 is in bold or not.



So I create the object [A1].characters:




set chr=[A1].characters




How can I get the property "bold/not bold" of each letter of the text?



(I'vee been looking for a way to build an array which dimension is the number of letters of A1, with 1's for bold letters and 0's for not bold letters, but I can't find it)



Thanks in advance for your help.







microsoft-excel






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 16 at 17:26









pruvierospruvieros

1




1













  • A faster way would be to get the format of cell B1 you want to keep, copy cell A1 into B1, then apply the original formatting back on B1.

    – cybernetic.nomad
    Jan 16 at 17:35











  • Would it really be faster? keeping copy of all formattings, implies keeping copy of all borders formatting, background formatting, poloce formatting, alignment formatting, etc (Big macro!)

    – pruvieros
    Jan 17 at 5:46













  • Please edit your question to give us an example of what you have and what the expected result is. This may be useful to help creating a good example.

    – cybernetic.nomad
    Jan 17 at 12:45





















  • A faster way would be to get the format of cell B1 you want to keep, copy cell A1 into B1, then apply the original formatting back on B1.

    – cybernetic.nomad
    Jan 16 at 17:35











  • Would it really be faster? keeping copy of all formattings, implies keeping copy of all borders formatting, background formatting, poloce formatting, alignment formatting, etc (Big macro!)

    – pruvieros
    Jan 17 at 5:46













  • Please edit your question to give us an example of what you have and what the expected result is. This may be useful to help creating a good example.

    – cybernetic.nomad
    Jan 17 at 12:45



















A faster way would be to get the format of cell B1 you want to keep, copy cell A1 into B1, then apply the original formatting back on B1.

– cybernetic.nomad
Jan 16 at 17:35





A faster way would be to get the format of cell B1 you want to keep, copy cell A1 into B1, then apply the original formatting back on B1.

– cybernetic.nomad
Jan 16 at 17:35













Would it really be faster? keeping copy of all formattings, implies keeping copy of all borders formatting, background formatting, poloce formatting, alignment formatting, etc (Big macro!)

– pruvieros
Jan 17 at 5:46







Would it really be faster? keeping copy of all formattings, implies keeping copy of all borders formatting, background formatting, poloce formatting, alignment formatting, etc (Big macro!)

– pruvieros
Jan 17 at 5:46















Please edit your question to give us an example of what you have and what the expected result is. This may be useful to help creating a good example.

– cybernetic.nomad
Jan 17 at 12:45







Please edit your question to give us an example of what you have and what the expected result is. This may be useful to help creating a good example.

– cybernetic.nomad
Jan 17 at 12:45












0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1395042%2fhow-can-i-get-the-exact-position-of-bold-words-in-a-cell%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1395042%2fhow-can-i-get-the-exact-position-of-bold-words-in-a-cell%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Сан-Квентин

8-я гвардейская общевойсковая армия

Алькесар