如何将配方放入细胞中 [英] How do I put formula into a cell

查看:108
本文介绍了如何将配方放入细胞中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试运行VBA将公式放入单元格



单元格(10,4)。公式== Max(H&FirstRow&,H&LastRow&)



我得到运行时间错误'1004':





感谢您的帮助



我尝试了什么:



我试过这个



细胞(10 ,4).Formula == Max(H2,H14)



它工作正常。

解决方案

< blockquote>

Quote:

 Cells( 10  4 )。公式=   = Max(H& FirstRow&,H&LastRow&) 



我得到运行时错误'1004':



因为报价错位。

尝试

单元格( 10 , 4 )。公式=   = Max( H& FirstRow&  ,H& LastRow&   


也许这将为您带来一些线索:

VBA教程:查找工作表上的最后一行,列或单元格 [ ^ ]

Hello everyone,
I'm trying to run VBA to put formula into a cell

Cells(10, 4).Formula = "=Max(H &""FirstRow""&,H &""LastRow""&)"

I get Run-time error '1004':


Thank you for your help

What I have tried:

I tried this

Cells(10, 4).Formula = "=Max(H2,H14)"

it works fine.

解决方案

Quote:

Cells(10, 4).Formula = "=Max(H &""FirstRow""&,H &""LastRow""&)"


I get Run-time error '1004':


Because quotes are misplaced.
Try

Cells(10, 4).Formula = "=Max(H" & FirstRow & ",H" & LastRow & ")"


Maybe that will bring you some clues about it:
VBA Tutorial: Find the Last Row, Column, or Cell on a Sheet[^]


这篇关于如何将配方放入细胞中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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