ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formula from VBA to Excel worksheet (https://www.excelbanter.com/excel-programming/284761-formula-vba-excel-worksheet.html)

Lars Kofod

Formula from VBA to Excel worksheet
 
How do I get this formula from VBA into a cell in an
Excell worksheet.

Code first.
sVSTid = Cells(lRaekke, 7).Address
sHvis = "=+hvis($i$230;$i$23*" & sVSTid
sVSLoen = Cells(lRaekke, 22).Address
sEllers = ";" & sVSLoen & ")"
sSumFormel = sHvis & sEllers
Debug.Print sSumFormel

It gives this formula: =+hvis($i$230;$i$23*$G$46;$V$46)
(danish IF-function)
It keeps failing me no matter what I do. So I must do
something wrong.

Please help me
Lars Kofod



Oliver Kharraz

Formula from VBA to Excel worksheet
 
Hi,

VBA is US-centric. Use "," instead of ";"

Cheers,

Olivers

--
Oliver Kharraz
"Lars Kofod" wrote in message
...
How do I get this formula from VBA into a cell in an
Excell worksheet.

Code first.
sVSTid = Cells(lRaekke, 7).Address
sHvis = "=+hvis($i$230;$i$23*" & sVSTid
sVSLoen = Cells(lRaekke, 22).Address
sEllers = ";" & sVSLoen & ")"
sSumFormel = sHvis & sEllers
Debug.Print sSumFormel

It gives this formula: =+hvis($i$230;$i$23*$G$46;$V$46)
(danish IF-function)
It keeps failing me no matter what I do. So I must do
something wrong.

Please help me
Lars Kofod





Tom Ogilvy

Formula from VBA to Excel worksheet
 
cells(1,1).FormulaLocal = sSumFormel

--
Regards,
Tom Ogilvy

"Lars Kofod" wrote in message
...
How do I get this formula from VBA into a cell in an
Excell worksheet.

Code first.
sVSTid = Cells(lRaekke, 7).Address
sHvis = "=+hvis($i$230;$i$23*" & sVSTid
sVSLoen = Cells(lRaekke, 22).Address
sEllers = ";" & sVSLoen & ")"
sSumFormel = sHvis & sEllers
Debug.Print sSumFormel

It gives this formula: =+hvis($i$230;$i$23*$G$46;$V$46)
(danish IF-function)
It keeps failing me no matter what I do. So I must do
something wrong.

Please help me
Lars Kofod






All times are GMT +1. The time now is 07:00 PM.

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