ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   function help (https://www.excelbanter.com/excel-programming/296412-function-help.html)

Mike VB

function help
 
Hello
I've an error:

Sheets(SheetDestination).Cells(row, col).Formula =
"=(19981,1882918624*452)/19981,1882918624"

En fait ma ligne de code exact est:
Sheets(SheetDestination).Cells(row, col).Formula = _
"=(" & Sheets(SheetSource).Cells(row, col).Value & _
"*" & Base & ") / " & ValEnt


Regrads





Tom Ogilvy

function help
 
Some added thoughts.

What error are you getting.

is row a number between 1 and 65536
is col a number between 1 and 256 or a single letter between a and z or a
double letter between AA and IV
Is SheetDestination a string variable having a value that corresponds to an
existing sheet name. Is that Sheet a worksheet?

--
Regards,
Tom Ogilvy


"Mike VB" wrote in message
...
Hello
I've an error:

Sheets(SheetDestination).Cells(row, col).Formula =
"=(19981,1882918624*452)/19981,1882918624"

En fait ma ligne de code exact est:
Sheets(SheetDestination).Cells(row, col).Formula = _
"=(" & Sheets(SheetSource).Cells(row, col).Value & _
"*" & Base & ") / " & ValEnt


Regrads







Mike VB

function help
 
Hi

this my source code

FeuilleSource = "feuil1"
FeuilleDestination = "feuil2"

firstCol = 2
lastCol = 4
ColonneNational = 5

firstrow = 2
DerniereLigne = 100

For colonne = firstCol To lastCol
ValEnt = ""
For ligne = firstrow To DerniereLigne
If Sheets(FeuilleSource).Cells(ligne, colonne).Value < "" Then
If ValEnt = "" Then
ValEnt = Sheets(FeuilleSource).Cells(ligne, colonne).Value
ValeurNational = Sheets(FeuilleSource).Cells(ligne,
ColonneNational).Value
End If
Sheets(FeuilleDestination).Cells(ligne, colonne).Formula = _
"=(" & Sheets(FeuilleSource).Cells(ligne, colonne).Value & _
"*" & ValeurNational & ") / " & ValEnt
End If
Next ligne
Next colonne


Best regards,
Mike


"NickHK" a écrit dans le message de
...
Mike,
Is ValEnt supposed to a number ?
What is it declared as ?

NickHK

"Mike VB" wrote in message
...
Hello
I've an error:

Sheets(SheetDestination).Cells(row, col).Formula =
"=(19981,1882918624*452)/19981,1882918624"

En fait ma ligne de code exact est:
Sheets(SheetDestination).Cells(row, col).Formula = _
"=(" & Sheets(SheetSource).Cells(row, col).Value & _
"*" & Base & ") / " & ValEnt


Regrads









NickHK[_2_]

function help
 
Mike,
Is ValEnt supposed to a number ?
What is it declared as ?

NickHK

"Mike VB" wrote in message
...
Hello
I've an error:

Sheets(SheetDestination).Cells(row, col).Formula =
"=(19981,1882918624*452)/19981,1882918624"

En fait ma ligne de code exact est:
Sheets(SheetDestination).Cells(row, col).Formula = _
"=(" & Sheets(SheetSource).Cells(row, col).Value & _
"*" & Base & ") / " & ValEnt


Regrads







NickHK[_2_]

function help
 
Mike,
Is there any point using .Formula when all your values are numbers not
refences ?

Also, doesn't your formaul boil down to:
[Destination].Formula = ValeurNational

Add a Debug.Print ValEnt, after ValEnt assignment to see what value you are
using.

It doesn't look like you are declaring your variable either.

NickHK

"Mike VB" wrote in message
...
Hi

this my source code

FeuilleSource = "feuil1"
FeuilleDestination = "feuil2"

firstCol = 2
lastCol = 4
ColonneNational = 5

firstrow = 2
DerniereLigne = 100

For colonne = firstCol To lastCol
ValEnt = ""
For ligne = firstrow To DerniereLigne
If Sheets(FeuilleSource).Cells(ligne, colonne).Value < "" Then
If ValEnt = "" Then
ValEnt = Sheets(FeuilleSource).Cells(ligne, colonne).Value
ValeurNational = Sheets(FeuilleSource).Cells(ligne,
ColonneNational).Value
End If
Sheets(FeuilleDestination).Cells(ligne, colonne).Formula = _
"=(" & Sheets(FeuilleSource).Cells(ligne, colonne).Value & _
"*" & ValeurNational & ") / " & ValEnt
End If
Next ligne
Next colonne


Best regards,
Mike


"NickHK" a écrit dans le message de
...
Mike,
Is ValEnt supposed to a number ?
What is it declared as ?

NickHK

"Mike VB" wrote in message
...
Hello
I've an error:

Sheets(SheetDestination).Cells(row, col).Formula =
"=(19981,1882918624*452)/19981,1882918624"

En fait ma ligne de code exact est:
Sheets(SheetDestination).Cells(row, col).Formula = _
"=(" & Sheets(SheetSource).Cells(row, col).Value & _
"*" & Base & ") / " & ValEnt


Regrads












All times are GMT +1. The time now is 02:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com