Excel 2010 VBA错误1004与公式 [英] Excel 2010 VBA Error 1004 with formula

查看:77
本文介绍了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.有什么主意吗?我已经按照用户定义的"m:ss"格式格式化了K列.

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天全站免登陆