带有公式的 Excel 2010 VBA 错误 1004 [英] Excel 2010 VBA Error 1004 with formula

查看:20
本文介绍了带有公式的 Excel 2010 VBA 错误 1004的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个代码:

Dim fStrecke As String
fStrecke = "=A" & z & "*B" & z & "*C" & z
wks.Cells(z, "L").Formula = fStrecke

Dim fZeit As String
fZeit = "=IF(ISBLANK(H" & z & ");((A" & z & "*B" & z & "*I" & z & ")-I" & z & ")+(A" & z & "*B" & z & "*J" & z & ");(A" & z & "*B" & z & "*H" & z & "))"
wks.Cells(z, "K").Formula = fZeit

第一个公式有效,第二个我收到运行时错误 1004.知道吗?我已将 K 列格式化为用户定义的m:ss".

The first formula is working and for the second i get an runtime error 1004. any idea? i have formatted the column K as user defined with "m:ss".

推荐答案

有两种选择:

  1. 使用 .FormulaLocal 属性:wks.Cells(z, "K").FormulaLocal = fZeit
  2. 使用逗号 , 作为分隔符而不是分号 ;(即使您的本地设置需要 ; 作为标准分隔符):
  1. use .FormulaLocal property: wks.Cells(z, "K").FormulaLocal = fZeit
  2. use comma , as separator instead of semicolon ; (even if your local settings require ; as standard separator):

<小时>

fZeit = "=IF(ISBLANK(H" & z & "),((A" & z & "*B" & z & "*I" & z & ")-I" & z & ")+(A" & z & "*B" & z & "*J" & z & "),(A" & z & "*B" & z & "*H" & z & "))"
wks.Cells(z, "K").Formula = fZeit

这篇关于带有公式的 Excel 2010 VBA 错误 1004的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆