Bonjour à tous,
Je débute en macro, du coup je cherche en prenant different model pour travailler dessus. Ce qui n'est pas desagreable 🙂. On apprend plein de chose comme cela. Par contre j'ai un petit soucis je ne comprends pas pourquoi cella fonctionne pas.
Voila le pb. :
Je pars d'un fichier qui me donne les informations par structure. Je veux identifier ses structure par un code. Je n'ai pas les memes données suivant les onglets.
J'ai commencé a taper cette macro
Sub Macro4()
'=============================================================================================
' Variables
Dim lig
Dim col
' Numero de colonne où se trouve structure
col = 2
' Numero de colonne où se place le resultat
res = 1
lig = 1
While Cells(lig, 1) <> ""
If Cells(lig, col) = "PMM" Then
Cells(lig, res) = "UBMU"
End If
If Cells(lig, col) = "UMC" Then
Cells(lig, res) = "UMCA"
End If
If Cells(lig, col) = "USF" Then
Cells(lig, res) = "UBSF"
End If
lig = lig + 1
' MsgBox Cells(lig, col)
Wend
End Sub
Si vous avez des idées... La perso je bug. Snif snif...
Je débute en macro, du coup je cherche en prenant different model pour travailler dessus. Ce qui n'est pas desagreable 🙂. On apprend plein de chose comme cela. Par contre j'ai un petit soucis je ne comprends pas pourquoi cella fonctionne pas.
Voila le pb. :
Je pars d'un fichier qui me donne les informations par structure. Je veux identifier ses structure par un code. Je n'ai pas les memes données suivant les onglets.
J'ai commencé a taper cette macro
Sub Macro4()
'=============================================================================================
' Variables
Dim lig
Dim col
' Numero de colonne où se trouve structure
col = 2
' Numero de colonne où se place le resultat
res = 1
lig = 1
While Cells(lig, 1) <> ""
If Cells(lig, col) = "PMM" Then
Cells(lig, res) = "UBMU"
End If
If Cells(lig, col) = "UMC" Then
Cells(lig, res) = "UMCA"
End If
If Cells(lig, col) = "USF" Then
Cells(lig, res) = "UBSF"
End If
lig = lig + 1
' MsgBox Cells(lig, col)
Wend
End Sub
Si vous avez des idées... La perso je bug. Snif snif...