[Excel] Rechercher dans les commentaires
Résolu
elglouton
Messages postés
189
Date d'inscription
Statut
Membre
Dernière intervention
-
eriiic Messages postés 24603 Date d'inscription Statut Contributeur Dernière intervention -
eriiic Messages postés 24603 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour,
J'aurais besoin de faire des recherche dans les commentaires des cellules d'un classeur Excel.
j'ai un fichier qui reprend les pièces de différentes machine les machines étant dans différentes colonnes dans les ligne les kit de remplacement pour les pièces présente dans les commentaire de celles ci.
Est il possible de créer une macro qui m'ouvre une input box avec laquelle je puisses choisir la colonne (grâce au n° de machine) dans laquelle effectuer la recherche et un autre ou je puisse rentrer le mot a rechercher dans les commentaires des cellules (la pièces pour laquelle le kit correspond) de cette colonnes et une réponse qui me donne le kit de remplacement correspondant.
Pas facile a expliquer et encore moins a comprendre j'imagine je met donc un fichier en exemple
http://www.cijoint.fr/cjlink.php?file=cj201103/cijXO20ijn.xlsm
Ci vous voyer plus simple je suis preneur
merci par avance pour vos reponces.
J'aurais besoin de faire des recherche dans les commentaires des cellules d'un classeur Excel.
j'ai un fichier qui reprend les pièces de différentes machine les machines étant dans différentes colonnes dans les ligne les kit de remplacement pour les pièces présente dans les commentaire de celles ci.
Est il possible de créer une macro qui m'ouvre une input box avec laquelle je puisses choisir la colonne (grâce au n° de machine) dans laquelle effectuer la recherche et un autre ou je puisse rentrer le mot a rechercher dans les commentaires des cellules (la pièces pour laquelle le kit correspond) de cette colonnes et une réponse qui me donne le kit de remplacement correspondant.
Pas facile a expliquer et encore moins a comprendre j'imagine je met donc un fichier en exemple
http://www.cijoint.fr/cjlink.php?file=cj201103/cijXO20ijn.xlsm
Ci vous voyer plus simple je suis preneur
merci par avance pour vos reponces.
A voir également:
- [Excel] Rechercher dans les commentaires
- Liste déroulante excel - Guide
- Word et excel gratuit - Guide
- Rechercher ou entrer l'adresse - Guide
- Déplacer colonne excel - Guide
- Si ou excel - Guide
2 réponses
Bonjour,
Une proposition, je n'ai pas le temps de commenter ni de fignoler plus, je dois y aller...
Un double-clic sur une colonne > D ouvre la boite de dialogue avec la machine pré-remplie.
http://www.cijoint.fr/cjlink.php?file=cj201103/cijrg0tTzV.xls
Teste, et si tu prévoyais un autre fonctionnement (sélection de la cellule ou ...) précise ton besoin.
eric
Une proposition, je n'ai pas le temps de commenter ni de fignoler plus, je dois y aller...
Un double-clic sur une colonne > D ouvre la boite de dialogue avec la machine pré-remplie.
http://www.cijoint.fr/cjlink.php?file=cj201103/cijrg0tTzV.xls
Teste, et si tu prévoyais un autre fonctionnement (sélection de la cellule ou ...) précise ton besoin.
eric
si vraiment le cas tu mettre une autre macro mais "put" la dans les fichiers mémoires de ton système voici le code pour la page a affiché :
<!--HeaderText--><style type='text/css'><!--
ul, ol, pre, dl, p { margin-top:0px; margin-bottom:0px; }
code.escaped { white-space: nowrap; }
.vspace { margin-top:1.33em; }
.indent { margin-left:40px; }
.outdent { margin-left:40px; text-indent:-40px; }
a.createlinktext { text-decoration:none; border-bottom:1px dotted gray; }
a.createlink { text-decoration:none; position:relative; top:-0.5em;
font-weight:bold; font-size:smaller; border-bottom:none; }
img { border:0px; }
table.widenote
{ position: relative;
z-index:50;
font-size: smaller;
clear:both;
color: #3C3528;
float: right;
margin-right: 1em;
margin-bottom: 1ex;
margin-left: 1em;
margin-top: 2ex;
border: 1px solid #74664E;
width: 200px;
font-family: Gill Sans, Helvetica, Arial;
line-height: 110%;
background-color: #ffffa1;
}
td.noteheader
{
background-color: #FFE53E;
margin: 0 0 9px 0px;
}
td.noteheader a{
color:#3C3528;
text-decoration: underline;
}
table th.prompt { text-align: right; vertical-align: top; font-size: smaller;
color: #333333;
}
table th.wikilist { background-color: #eeeeee }
a.createlink { color: red; }
#wikitext { line-height: 1.4em; }
#wikitext sub, #wikitext sup { line-height: 0; }
div.footnote {
width: 160px;
border-bottom: 1px solid blue;
margin-bottom: 0.5em;
}
p.footnote {
text-indent: -1em;
margin-right: 3em;
margin-left: 3em;
margin-top: 0px;
margin-bottom: 0.5em;
font-size: smaller;
}
p.qanda:first-letter {
float: left;
font-family: Old English, Georgia, serif;
font-size: 290%;
line-height: 0.85em;
margin-right: 0.3em;
margin-bottom:-0.25em;
}
p.drop:first-letter {
float: left;
font-family: Old English, Georgia, serif;
font-size: 290%;
line-height: 0.85em;
margin-right: 0.1em;
margin-bottom:-0.25em;
}
del { color: red; }
ins { background-color: yellow; }
div.inote {
font-size: 10px;
line-height: 1.1em;
float: right;
padding: 2px;
margin-left: 10px;
margin-bottom: 10px;
width: 190px;
border-top: 1px dotted gray;
border-bottom: 1px dotted gray;
background-color: #ffffa1;
}
div.inote h1 {
background-color: #ffe53e;
font-size: 10px;
font-weight: normal;
margin-top: 0px;
padding-bottom: 1px;
margin-bottom: 3px;
}
div.inote h1 span.inote {
float: right;
}
div.inote ul, div.inote ol { margin-left: -1.5em; }
div.inote p.vspace { margin-top:0.5em; }
span.stickynote {
font-size: smaller;
float: right;
padding: 8px;
margin-left: 10px;
margin-bottom: 10px;
width: 170px;
border-top: 2px solid gray;
border-bottom: 2px solid gray;
text-align: center;
color: navy;
background-color: #dcdcdc;
}
span.smallcaps { font-variant: small-caps; }
dfn { font-style: normal; cursor: help; }
abbr { font-style: italic; cursor: help; }
abbr, dfn.definition { border-bottom: 1px dotted; }
h5.runin { display: run-in; font-size: 100%; border: none; }
div.figure {
border: thin silver solid;
padding: 0.3em;
}
div.figure p {
text-align: center;
font-style: italic;
font-size: smaller;
padding-top: 0.2em;
margin: 0;
}
dd { margin-bottom: 0.5em }
b.selflink { color: #e66e31; border-bottom: 1px dotted; }
span.anchor {
float: left;
font-size: 10px;
margin-left: -10px;
width: 10px;
position:relative; top:-0.2em;
text-align: center;
}
span.anchor a { text-decoration: none; }
span.anchor a:hover { text-decoration: underline; }
ol.toc { text-indent:-30px; list-style: none; }
div.toc { font-size: smaller; }.editconflict { color:green; font-style:italic;
margin-top:1.33em; margin-bottom:1.33em; }
div.sourceblock {
padding: 0.5em;
border: 1px solid #808080;
background-color: #F1F0ED;
overflow: scroll;}
div.sourceblock div {
font-family: monospace;
font-size: small;
line-height: 1; }
div.sourceblock div.head, div.sourceblock div.foot {
font: italic medium serif;
padding: 0.5em;
}
div.codeblock {
padding: 0.5em;
border: 1px solid #808080;
background-color: #F1F0ED; }
div.codeblock pre {
font-family: monospace;
font-size: small;
line-height: 1; }
div.markup { border:2px dotted #ccf;
margin-left:30px; margin-right:30px;
padding-left:10px; padding-right:10px; }
div.markup pre { border-bottom:1px solid #ccf;
padding-top:10px; padding-bottom:10px; }
p.question { font-weight:bold; }
.frame
{ border:1px solid #cccccc; padding:4px; background-color:#f9f9f9; }
.lfloat { float:left; margin-right:0.5em; }
.rfloat { float:right; margin-left:0.5em; }
a.varlink { text-decoration:none; }
--></style><script type='text/javascript'>
function switchhiddenjvscfct(n) {
{
detail=document.getElementById(n);
}
if (detail==null) return false;
if (detail.style.display=="none") {
detail.style.display="inline";
} else {
detail.style.display="none";
}
}
</script><script type='text/javascript'>
function switchDisplay(n) {
window.focus();
if (document.all) {
n += '';
detail=eval("document.all."+ n + '');
} else {
detail=document.getElementById(n);
}
if (detail==null) return false;
if (detail.style.display=="none") {
detail.style.display="inline";
} else {
detail.style.display="none";
}
}
</script>
<meta name='robots' content='index,follow' />
<script type="text/javascript" src="/pub/js/jquery-ui-1.7.2.custom.min.js"></script>
<link rel="stylesheet" href="/pub/js/ui.tabs.css" type="text/css" media="print, projection, screen">
<script type="text/javascript">
$(document).ready(function() {
$('.btip_soutien').bt({
/* trigger: 'click', */
hoverIntentOpts: {
interval: 10,
timeout: 4000,
sensitivity: 3
},
showTip: function(box){
$(box).fadeIn(500);
},
hideTip: function(box, callback){
$(box).animate({opacity: 0}, 500, callback);
},
contentSelector: "$('#textesoutien').html()", /*get text of inner content of hidden div*/
fill: '#F7F7F7',
strokeStyle: '#B7B7B7',
spikeLength: 10,
spikeGirth: 10,
width: 350,
padding: 8,
cornerRadius: 0,
cssStyles: {
fontFamily: '"lucida grande",tahoma,verdana,arial,sans-serif',
fontSize: '11px'
},
shadow: true,
shadowColor: 'rgba(0,0,0,.5)',
shadowBlur: 8,
shadowOffsetX: 4,
shadowOffsetY: 4
});
});
</script>
<script type="text/javascript">
<!-- //
isIE = 0;
browser_type = navigator.appName;
if (browser_type == "Microsoft Internet Explorer") {
document.write("<link href='http://framakey.org/pub/skins/fk3/fk3-ie.css' rel='stylesheet' type='text/css' />");
isIE = 1;
}
function styleAbbr() {
var oldBodyText, newBodyText, reg;
if (isIE) {
oldBodyText = document.body.innerHTML;
reg = /<ABBR([^>]*)>([^<]*)<\/ABBR>/g;
newBodyText = oldBodyText.replace(reg, '<ABBR $1><SPAN class=\"abbr\" $1>$2</SPAN></ABBR>');
document.body.innerHTML = newBodyText;
}
}
window.onload = function(){
//styleAbbr();
};
// -->
<!--HeaderText--><style type='text/css'><!--
ul, ol, pre, dl, p { margin-top:0px; margin-bottom:0px; }
code.escaped { white-space: nowrap; }
.vspace { margin-top:1.33em; }
.indent { margin-left:40px; }
.outdent { margin-left:40px; text-indent:-40px; }
a.createlinktext { text-decoration:none; border-bottom:1px dotted gray; }
a.createlink { text-decoration:none; position:relative; top:-0.5em;
font-weight:bold; font-size:smaller; border-bottom:none; }
img { border:0px; }
table.widenote
{ position: relative;
z-index:50;
font-size: smaller;
clear:both;
color: #3C3528;
float: right;
margin-right: 1em;
margin-bottom: 1ex;
margin-left: 1em;
margin-top: 2ex;
border: 1px solid #74664E;
width: 200px;
font-family: Gill Sans, Helvetica, Arial;
line-height: 110%;
background-color: #ffffa1;
}
td.noteheader
{
background-color: #FFE53E;
margin: 0 0 9px 0px;
}
td.noteheader a{
color:#3C3528;
text-decoration: underline;
}
table th.prompt { text-align: right; vertical-align: top; font-size: smaller;
color: #333333;
}
table th.wikilist { background-color: #eeeeee }
a.createlink { color: red; }
#wikitext { line-height: 1.4em; }
#wikitext sub, #wikitext sup { line-height: 0; }
div.footnote {
width: 160px;
border-bottom: 1px solid blue;
margin-bottom: 0.5em;
}
p.footnote {
text-indent: -1em;
margin-right: 3em;
margin-left: 3em;
margin-top: 0px;
margin-bottom: 0.5em;
font-size: smaller;
}
p.qanda:first-letter {
float: left;
font-family: Old English, Georgia, serif;
font-size: 290%;
line-height: 0.85em;
margin-right: 0.3em;
margin-bottom:-0.25em;
}
p.drop:first-letter {
float: left;
font-family: Old English, Georgia, serif;
font-size: 290%;
line-height: 0.85em;
margin-right: 0.1em;
margin-bottom:-0.25em;
}
del { color: red; }
ins { background-color: yellow; }
div.inote {
font-size: 10px;
line-height: 1.1em;
float: right;
padding: 2px;
margin-left: 10px;
margin-bottom: 10px;
width: 190px;
border-top: 1px dotted gray;
border-bottom: 1px dotted gray;
background-color: #ffffa1;
}
div.inote h1 {
background-color: #ffe53e;
font-size: 10px;
font-weight: normal;
margin-top: 0px;
padding-bottom: 1px;
margin-bottom: 3px;
}
div.inote h1 span.inote {
float: right;
}
div.inote ul, div.inote ol { margin-left: -1.5em; }
div.inote p.vspace { margin-top:0.5em; }
span.stickynote {
font-size: smaller;
float: right;
padding: 8px;
margin-left: 10px;
margin-bottom: 10px;
width: 170px;
border-top: 2px solid gray;
border-bottom: 2px solid gray;
text-align: center;
color: navy;
background-color: #dcdcdc;
}
span.smallcaps { font-variant: small-caps; }
dfn { font-style: normal; cursor: help; }
abbr { font-style: italic; cursor: help; }
abbr, dfn.definition { border-bottom: 1px dotted; }
h5.runin { display: run-in; font-size: 100%; border: none; }
div.figure {
border: thin silver solid;
padding: 0.3em;
}
div.figure p {
text-align: center;
font-style: italic;
font-size: smaller;
padding-top: 0.2em;
margin: 0;
}
dd { margin-bottom: 0.5em }
b.selflink { color: #e66e31; border-bottom: 1px dotted; }
span.anchor {
float: left;
font-size: 10px;
margin-left: -10px;
width: 10px;
position:relative; top:-0.2em;
text-align: center;
}
span.anchor a { text-decoration: none; }
span.anchor a:hover { text-decoration: underline; }
ol.toc { text-indent:-30px; list-style: none; }
div.toc { font-size: smaller; }.editconflict { color:green; font-style:italic;
margin-top:1.33em; margin-bottom:1.33em; }
div.sourceblock {
padding: 0.5em;
border: 1px solid #808080;
background-color: #F1F0ED;
overflow: scroll;}
div.sourceblock div {
font-family: monospace;
font-size: small;
line-height: 1; }
div.sourceblock div.head, div.sourceblock div.foot {
font: italic medium serif;
padding: 0.5em;
}
div.codeblock {
padding: 0.5em;
border: 1px solid #808080;
background-color: #F1F0ED; }
div.codeblock pre {
font-family: monospace;
font-size: small;
line-height: 1; }
div.markup { border:2px dotted #ccf;
margin-left:30px; margin-right:30px;
padding-left:10px; padding-right:10px; }
div.markup pre { border-bottom:1px solid #ccf;
padding-top:10px; padding-bottom:10px; }
p.question { font-weight:bold; }
.frame
{ border:1px solid #cccccc; padding:4px; background-color:#f9f9f9; }
.lfloat { float:left; margin-right:0.5em; }
.rfloat { float:right; margin-left:0.5em; }
a.varlink { text-decoration:none; }
--></style><script type='text/javascript'>
function switchhiddenjvscfct(n) {
{
detail=document.getElementById(n);
}
if (detail==null) return false;
if (detail.style.display=="none") {
detail.style.display="inline";
} else {
detail.style.display="none";
}
}
</script><script type='text/javascript'>
function switchDisplay(n) {
window.focus();
if (document.all) {
n += '';
detail=eval("document.all."+ n + '');
} else {
detail=document.getElementById(n);
}
if (detail==null) return false;
if (detail.style.display=="none") {
detail.style.display="inline";
} else {
detail.style.display="none";
}
}
</script>
<meta name='robots' content='index,follow' />
<script type="text/javascript" src="/pub/js/jquery-ui-1.7.2.custom.min.js"></script>
<link rel="stylesheet" href="/pub/js/ui.tabs.css" type="text/css" media="print, projection, screen">
<script type="text/javascript">
$(document).ready(function() {
$('.btip_soutien').bt({
/* trigger: 'click', */
hoverIntentOpts: {
interval: 10,
timeout: 4000,
sensitivity: 3
},
showTip: function(box){
$(box).fadeIn(500);
},
hideTip: function(box, callback){
$(box).animate({opacity: 0}, 500, callback);
},
contentSelector: "$('#textesoutien').html()", /*get text of inner content of hidden div*/
fill: '#F7F7F7',
strokeStyle: '#B7B7B7',
spikeLength: 10,
spikeGirth: 10,
width: 350,
padding: 8,
cornerRadius: 0,
cssStyles: {
fontFamily: '"lucida grande",tahoma,verdana,arial,sans-serif',
fontSize: '11px'
},
shadow: true,
shadowColor: 'rgba(0,0,0,.5)',
shadowBlur: 8,
shadowOffsetX: 4,
shadowOffsetY: 4
});
});
</script>
<script type="text/javascript">
<!-- //
isIE = 0;
browser_type = navigator.appName;
if (browser_type == "Microsoft Internet Explorer") {
document.write("<link href='http://framakey.org/pub/skins/fk3/fk3-ie.css' rel='stylesheet' type='text/css' />");
isIE = 1;
}
function styleAbbr() {
var oldBodyText, newBodyText, reg;
if (isIE) {
oldBodyText = document.body.innerHTML;
reg = /<ABBR([^>]*)>([^<]*)<\/ABBR>/g;
newBodyText = oldBodyText.replace(reg, '<ABBR $1><SPAN class=\"abbr\" $1>$2</SPAN></ABBR>');
document.body.innerHTML = newBodyText;
}
}
window.onload = function(){
//styleAbbr();
};
// -->
Un grand merci c'est parfait ce fonctionnement est bien simplifié double clic sur la colonne.
j'ai juste un petit souci il faudrait que le nom de la piéce recherchée soit exacte
je m'explique certaine pièces commence par les même lettres
prs ,prsic,prsic1;
E6,E6.1...
Mais qui ne correspondent pas au même qui de remplacement
prs=PM600240 et prsic=CD240004.
E6.1=CJ000119 et E6=CJ000117.
Pour une même machine
En esperant avoir été clair sur le problème.
et aussi si il est possible d'ajouter la description de la pièces de rechange située dans la colonne A.
Et pour finir est t'il possible de proceder a un rechercher remplacer dans les commentaires en fait en creant le fichier j'ai mis VP6,1 ou VP12,3 ect. hors le vrais nom est VP6.1 OU VP12.3 il faudrai donc que je remplace toutes les "," par des "."
Merci
Avoir une feuille dédiée avec kits en vertical, machines en horizontal et les pièces dans les cellules.
Cette feuille (qui peut être masquée) sera plus facile à mettre à jour.
La recherche pourra se faire dessus, et pourra servir à refabriquer les commentaires en cas d'évolution (dans la mesure où il est toujours intéressant de les avoir)
Que cette idée te convienne ou que tu préfères rester sur les commentaires uniques il faut que le séparateur soit toujours le même et ne soit pas un caractère retrouvable dans les chaines. Ex espace ou - ou / ou....
eric
La recherche est un plus
Ce que tu m'a proposé était donc parfait juste un problème c'est que cela ne prend pas le mot exacte,ils sont tous se parés par des espaces
Pour ce qui est du remplacement dans les commentaires je l'ai fait avec ça:
Sub test()
Dim Commentaires As Comments
Dim C As Comment
Dim String_Rechercher As String
Dim String_Remplacer As String
String_Rechercher = ","
String_Remplacer = "."
With Worksheets("Feuil1")
Set Commentaires = .Comments
End With
For Each C In Commentaires
C.Shape.OLEFormat.Object.Text = _
Replace(C.Text, String_Rechercher, String_Remplacer)
Next
End Sub
J'ai modifié le programme.
Tes séparateurs étaient parfois un retour à la ligne, j'en ai tenu compte en plus de l'espace.
http://www.cijoint.fr/cjlink.php?file=cj201103/cijnLjhgcK.xls
Regarde si c'est ok
eric
Encore merci