Sélection de tableau excel vba
fkuhn
-
fkuhn -
fkuhn -
Bonjour, je suis débutant en vba!!
Je souhaiterai sélectionner automatiquement un tableau (je lái fait mais manuellement . copier coller de forums...) sachant que ce tableau comprend toujours les colonnes I3:P3 mais le nombre de lignes peut varier, j' comme vous le constatez, utilisé la fonction active sheet, dc mon tableau est sélectionner a priori! apres ca je souhaite utiliser les cellules de ma sélection pour les colorer et là g un bug!! il ne veux pas et je galere un peu!! Dáutant plus que le PC est espagnol, donc les msgs d'erreurs aussi et que je ne peux pas chger la langue(plusieurs utilisateurs)
voici mon programme , le probl`me (enfin pour l'instant est au début)
Sub Halloformato()
Dim Plage As Range, h, i&, Cell As Range, Rng As Range, j, k, m As Integer, n, p, q, s
ActiveSheet.Rows("I3 to P3").CurrentRegion.Select = Plage
For Each Cell In Plage
For i = 1 To Plage.Count
Set Rng = Cell.Offset(i)
If Cell <> "0" Then
Cell.Interior.ColorIndex = 4
Exit For
End If
Next i
Next Cell
For Each Cell In Plage
For i = 1 To Plage.Count
Set Rng = Cell.Offset(i)
If Rng <> "" And Rng = Cell Then
Cell.Interior.ColorIndex = 6
Rng.Interior.ColorIndex = 6
Exit For
End If
Next i
Next Cell
For Each Cell In Plage
For i = 1 To Plage.Count
Set Rng = Cell.Offset(i)
If Cell = "0" Then
Cell.Interior.ColorIndex = 34
Exit For
End If
Next i
Next Cell
For Each Cell In Plage
If Cell.Interior.Color = 6 And 4 Then
Cell = j
For j = 1 To Plage.Count
If j < j + 1 Then
j = j + 1
End If
Next j
End If
If Cell.Interior.Color = 6 And 4 Then
Cell = k
For k = 1 To Plage.Count
If k > k + 1 Then
k = k + 1
End If
Next k
End If
Next Cell
m = k - j
n = Inputbox("Numero de formato initial", "")
p = m / n
q = k - p
s = q - p
End Sub
Je souhaiterai sélectionner automatiquement un tableau (je lái fait mais manuellement . copier coller de forums...) sachant que ce tableau comprend toujours les colonnes I3:P3 mais le nombre de lignes peut varier, j' comme vous le constatez, utilisé la fonction active sheet, dc mon tableau est sélectionner a priori! apres ca je souhaite utiliser les cellules de ma sélection pour les colorer et là g un bug!! il ne veux pas et je galere un peu!! Dáutant plus que le PC est espagnol, donc les msgs d'erreurs aussi et que je ne peux pas chger la langue(plusieurs utilisateurs)
voici mon programme , le probl`me (enfin pour l'instant est au début)
Sub Halloformato()
Dim Plage As Range, h, i&, Cell As Range, Rng As Range, j, k, m As Integer, n, p, q, s
ActiveSheet.Rows("I3 to P3").CurrentRegion.Select = Plage
For Each Cell In Plage
For i = 1 To Plage.Count
Set Rng = Cell.Offset(i)
If Cell <> "0" Then
Cell.Interior.ColorIndex = 4
Exit For
End If
Next i
Next Cell
For Each Cell In Plage
For i = 1 To Plage.Count
Set Rng = Cell.Offset(i)
If Rng <> "" And Rng = Cell Then
Cell.Interior.ColorIndex = 6
Rng.Interior.ColorIndex = 6
Exit For
End If
Next i
Next Cell
For Each Cell In Plage
For i = 1 To Plage.Count
Set Rng = Cell.Offset(i)
If Cell = "0" Then
Cell.Interior.ColorIndex = 34
Exit For
End If
Next i
Next Cell
For Each Cell In Plage
If Cell.Interior.Color = 6 And 4 Then
Cell = j
For j = 1 To Plage.Count
If j < j + 1 Then
j = j + 1
End If
Next j
End If
If Cell.Interior.Color = 6 And 4 Then
Cell = k
For k = 1 To Plage.Count
If k > k + 1 Then
k = k + 1
End If
Next k
End If
Next Cell
m = k - j
n = Inputbox("Numero de formato initial", "")
p = m / n
q = k - p
s = q - p
End Sub
A voir également:
- Sélection de tableau excel vba
- Tableau word - Guide
- Trier un tableau excel - Guide
- Imprimer tableau excel sur une page - Guide
- Liste déroulante excel - Guide
- Tableau ascii - Guide