Methode Range

Didier972

XLDnaute Junior
Bonjour

J'aimerais savoir, comment appliquer la méthode Range et select pour remplacer cette formule

Range("A33:K33").Select

En queque chose comme cela (mais qui fonctionne)....lol

Range("c(1,1):c(1,11)").Select

Merci

Didier
 

Didier972

XLDnaute Junior
Re : Methode Range

Non, cela ne marche pas, car ce n'est pas la ligne 1 qui faut sélectionner, c'est aléatoire

car juste avant j'ai cette formule ci :

Code:
Private Sub CB_OK_Click()
HA = CDec(TB_HA) & ":" & CDec(TB_MA)
HD = CDec(TB_HF) & ":" & CDec(TB_MF)
With Sheets("base de donnees")
           
            Set c = .Range("A" & .Cells(.Rows.Count, 1).End(xlUp).Row)(2)
            
            'y mettre le nom
            c.Value = CDec(Lab_Mois) & "/" & CDec(TB_Jour) & "/" & CDec(TB_Annee)
            c(1, 2) = CDec(Lab_Mois) & "/" & CDec(TB_Jour) & "/" & CDec(TB_Annee)
            c(1, 3).FormulaR1C1 = "=IF(WEEKDAY(RC4,2)=7,""Dimanche"",IF(ISNA(VLOOKUP(RC[1],JoursFerie,1,FALSE)),""Normal"",""Férié""))"
            c(1, 4) = CDec(Lab_Mois) & "/" & CDec(TB_Jour) & "/" & CDec(TB_Annee)
            
            
            
            If Lab_Nom = "" Then
            MsgBox "Veuillez sélectionner un Nom"
            Else
            c(1, 5) = Lab_Nom
            End If
            c(1, 6) = HA 'CDec(TB_HA) & ":" & CDec(TB_MA)
            c(1, 7) = HD 'CDec(TB_HF) & ":" & CDec(TB_MF)
            c(1, 8).FormulaR1C1 = "=IF(MOD(RC[-1]-RC[-2],1)>R1C36,R1C34,0)" 'Pause
            c(1, 9).FormulaR1C1 = "=IF(OR(WEEKDAY(RC[-5],2)=7,RC[-6]=""Férié""),RC[1],IF(RC[-2]>R1C38,MOD(MIN(RC[-2],R1C40)-MAX(RC[-3],R1C38),1),""""))"
            c(1, 10).FormulaR1C1 = "=IF(RC[-3]="""","""",MOD(RC[-3]-RC[-4],1)-RC[-2])"
            c(1, 11).FormulaR1C1 = "=IF(RC[-2]="""",RC[-1],RC[-2]+RC[-1])"

Call Cadre
End With
            
 End Sub

Call Cadre c'est la ligne en rouge qui m'intéresse.

Code:
Sub Cadre()
'
' Cadre Macro
'

'
    [COLOR="#FF0000"]Range(Cells(1, 1), Cells(1, 11)).Select[/COLOR]    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = xlAutomatic
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = xlAutomatic
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = xlAutomatic
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = xlAutomatic
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .ColorIndex = xlAutomatic
        .TintAndShade = 0
        .Weight = xlThin
    End With
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
End Sub
 

Discussions similaires

Réponses
11
Affichages
513

Statistiques des forums

Discussions
312 378
Messages
2 087 758
Membres
103 660
dernier inscrit
205 Peugeot