Range: Concatener un entier entré dans une cellule

Bonjour,

Je cherche à faire la chose suivante: est-ce possible? (Sachant que Cells(6,4)=M-t=365 et contient donc une formule)

Range("A1:" + "A" + Worksheets("Feuil1").Cells(6, 4)).Select

Bonjour,

Pour le principe !?

Dim n As Long
n = Worksheets("Feuil1").Cells(6, 4).Value
Cells(1).Resize(n).Select

Bonsoir Jean Eric,

J'ai besoin de rendre un graphe dynamique en fait:

Je dois trouver la bonne syntax pour la ligne suivante:

ActiveChart.SetSourceData Source:=Range("Feuil3!A1:" + "A" + Worksheets("Feuil1").Cells(6, 4))

Le bouton CUI lance le code:

Cordialement.

Ludo

cf attachement

Sub CUIPRICE()
Dim Barrierefranchise As Integer
GetData
Dim Stinit As Double
Stinit = St
Dim moyenneCUI As Double
Dim unif As Double
moyenneCUI = 0
Dim Stplusdt As Double
Dim i As Long
Dim j As Long
Dim tincr As Double
Dim RNG As Range
Randomize
If t = 0 Then
    tincr = 1 / 365
End If
Dim counter As Long
counter = 0
If St < L Then
    For i = 1 To N
        counter = counter + 1
        Barrierefranchise = 0
        For j = partieentiere(tincr * 365) To partieentiere((M * 365))

            unif = Rnd
            z = WorksheetFunction.Norm_Inv(unif, 0, 1)
            Stplusdt = St * (1 + z * sigma * WorksheetFunction.Power((M - t) / 365, 0.5) + (r - div) * ((M - t) / 365))
            St = Stplusdt
            If Stplusdt > L Then
                Barrierefranchise = 1
            End If
            If counter = 1 Then
            Worksheets("Feuil3").Cells(j, 1) = St
            Worksheets("Feuil3").Select
            Range("A1:" + "A" + Worksheets("Feuil1").Cells(6, 4)).Select
            Range(Selection, Selection.End(xlDown)).Select
            ActiveSheet.Shapes.AddChart2(227, xlLineMarkers).Select
            ActiveChart.SetSourceData Source:=Range("Feuil3!A1:" + "A" + Worksheets("Feuil1").Cells(6, 4))
            ActiveChart.ChartTitle.Select
            ActiveChart.ChartTitle.Text = "Graphique ?chantillon du Sch?ma d'Euler de la m?thode MC "
            Selection.Format.TextFrame2.TextRange.Characters.Text = _
                "Graphique ?chantillon du Sch?ma d'Euler de la m?thode MC"
            With Selection.Format.TextFrame2.TextRange.Characters(1, 4).Font
                .BaselineOffset = 0
                .Bold = msoFalse
                .NameComplexScript = "+mn-cs"
                .NameFarEast = "+mn-ea"
                .Fill.Visible = msoTrue
                .Fill.ForeColor.RGB = RGB(89, 89, 89)
                .Fill.Transparency = 0
                .Fill.Solid
                .Size = 14
                .Italic = msoFalse
                .Kerning = 12
                .Name = "+mn-lt"
                .UnderlineStyle = msoNoUnderline
                .Spacing = 0
                .Strike = msoNoStrike
            End With
            ActiveChart.PlotArea.Select
            ActiveChart.ClearToMatchStyle
            ActiveChart.ChartStyle = 233
            ActiveChart.FullSeriesCollection(1).Select
            ActiveChart.ChartTitle.Select
            With Selection.Format.Line
                .Visible = msoTrue
                .ForeColor.RGB = RGB(192, 0, 0)
                .Transparency = 0
            End With
            With Selection.Format.Line
                .Visible = msoTrue
                .ForeColor.RGB = RGB(192, 0, 0)
                .Transparency = 0
            End With
            With Selection.Format.Line
                .Visible = msoTrue
                .ForeColor.ObjectThemeColor = msoThemeColorBackground1
                .ForeColor.TintAndShade = 0
                .ForeColor.Brightness = 0
                .Transparency = 0
            End With
            Selection.Format.Line.Visible = msoFalse
            ActiveChart.ChartArea.Select
            With Selection.Format.TextFrame2.TextRange.Font.Fill
                .Visible = msoTrue
                .ForeColor.RGB = RGB(0, 176, 80)
                .Transparency = 0
                .Solid
            End With
            ActiveChart.Parent.Cut
            Sheets("Feuil1").Select
            Range("A27").Select
            ActiveSheet.Paste
            End If
        Next
        If Barrierefranchise = 1 Then
            moyenneCUI = moyenneCUI + Barrierefranchise * partiepositive(St - K)
        End If
        St = Stinit
    Next
ElseIf St > L Then
    moyenneCUI = 0
End If
Worksheets("Feuil1").Cells(17, 4) = Exp(-r * (M - t)) * moyenneCUI / N
End Sub

Re,

Point 1 : Pas de valeur dans le cellule D6 [Cells(6,4)] dans Feuil3

Point 2 : Quelle procédure prendre en compte ? Celle dans le message joint ou celle dans le fichier ?

Cdlt.

J'ai trouvé une solution de contournement

Merci pour ton aide

Sub CUIPRICE()
Dim Barrierefranchise As Integer
GetData
Dim Stinit As Double
Stinit = St
Dim moyenneCUI As Double
Dim unif As Double
moyenneCUI = 0
Dim Stplusdt As Double
Dim i As Long
Dim j As Long
Dim tincr As Double
Dim RNG As Range
Randomize
If t = 0 Then
    tincr = 1 / 365
End If
Dim counter As Long
counter = 0
Sheets("Feuil3").Select
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
If St < L Then
    For i = 1 To N
        counter = counter + 1
        Barrierefranchise = 0
        For j = partieentiere(tincr * 365) To partieentiere((M * 365))
            unif = Rnd
            z = WorksheetFunction.Norm_Inv(unif, 0, 1)
            Stplusdt = St * (1 + z * sigma * WorksheetFunction.Power((M - t) / 365, 0.5) + (r - div) * ((M - t) / 365))
            St = Stplusdt
            If Stplusdt > L Then
                Barrierefranchise = 1
            End If
            If counter = 1 Then
            Worksheets("Feuil3").Cells(j, 1) = St
            End If
        Next
            If counter = 1 Then
            Worksheets("Feuil3").Select
            Range("A1").Select
            Range(Selection, Selection.End(xlDown)).Select
            ActiveSheet.Shapes.AddChart2(227, xlLineMarkers).Select
            ActiveChart.SetSourceData Source:=Range("Feuil3!A:A")
            ActiveChart.ChartTitle.Select
            ActiveChart.ChartTitle.Text = "Graphique ?chantillon du Sch?ma d'Euler de la m?thode MC "
            Selection.Format.TextFrame2.TextRange.Characters.Text = _
                "Graphique ?chantillon du Sch?ma d'Euler de la m?thode MC"
            With Selection.Format.TextFrame2.TextRange.Characters(1, 4).Font
                .BaselineOffset = 0
                .Bold = msoFalse
                .NameComplexScript = "+mn-cs"
                .NameFarEast = "+mn-ea"
                .Fill.Visible = msoTrue
                .Fill.ForeColor.RGB = RGB(89, 89, 89)
                .Fill.Transparency = 0
                .Fill.Solid
                .Size = 14
                .Italic = msoFalse
                .Kerning = 12
                .Name = "+mn-lt"
                .UnderlineStyle = msoNoUnderline
                .Spacing = 0
                .Strike = msoNoStrike
            End With
            ActiveChart.PlotArea.Select
            ActiveChart.ClearToMatchStyle
            ActiveChart.ChartStyle = 233
            ActiveChart.FullSeriesCollection(1).Select
            ActiveChart.ChartTitle.Select
            With Selection.Format.Line
                .Visible = msoTrue
                .ForeColor.RGB = RGB(192, 0, 0)
                .Transparency = 0
            End With
            With Selection.Format.Line
                .Visible = msoTrue
                .ForeColor.RGB = RGB(192, 0, 0)
                .Transparency = 0
            End With
            With Selection.Format.Line
                .Visible = msoTrue
                .ForeColor.ObjectThemeColor = msoThemeColorBackground1
                .ForeColor.TintAndShade = 0
                .ForeColor.Brightness = 0
                .Transparency = 0
            End With
            Selection.Format.Line.Visible = msoFalse
            ActiveChart.ChartArea.Select
            With Selection.Format.TextFrame2.TextRange.Font.Fill
                .Visible = msoTrue
                .ForeColor.RGB = RGB(0, 176, 80)
                .Transparency = 0
                .Solid
            End With
            ActiveChart.Parent.Cut
            Sheets("Feuil1").Select
            Range("A27").Select
            ActiveSheet.Paste
        End If
        If Barrierefranchise = 1 Then
            moyenneCUI = moyenneCUI + Barrierefranchise * partiepositive(St - K)
        End If
        St = Stinit
    Next
ElseIf St > L Then
    moyenneCUI = 0
End If
Worksheets("Feuil1").Cells(17, 4) = Exp(-r * (M - t)) * moyenneCUI / N
End Sub
Rechercher des sujets similaires à "range concatener entier entre"