通过Visual BASIC设置Excel cell.value [英] setting Excel cell.value through Visual BASIC

查看:146
本文介绍了通过Visual BASIC设置Excel cell.value的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我在Excel电子表格中设置单元格值(或fromat或...)时遇到问题,使用类似我的模块中的VB语句: br />
范围(C1)。值= 20


我在一个函数中有这个。如果我处于调试模式并且在该行处具有断点,则可以看到何时将鼠标悬停在Range(C1)上。该单元格中的实际值(在我的情况下为30),但是当我想要进入下一个语句时,VB程序结束(由于某些错误?)。

单元格值未更改到20岁。


有人能帮帮我吗?我尝试了其他几种方法来改变细胞,比如Range(AtmosProfile)。细胞(1,3).Value = 2 * 5

但这也行不通......


我是否需要在Visual BASIC模块中声明我允许在电子表格中设置单元格(我的工作表中没有保护)。


我在Microsoft Excel 2000中使用Microsoft Visual BASIC 6.0


感谢您的帮助。


一切顺利,



Victor

Hello all of you,

I have some problem in setting cells values (or fromat or...) in my Excel spreadsheet using a VB statement like within my Module:
Range("C1").Value = 20

I have this in a function. If I am in debug mode and have a breakpoint at this line, I can see when hovering my mouse over "Range("C1").Value" the actual value in that cell (in my case 30), but when I want to step to the next statement, the VB programs ends (due to some error?).
The cell value is not changed to 20.

Can someone help me? I tried several other methods to change cells, like Range(AtmosProfile).Cells(1, 3).Value = 2 * 5
but also this does not work...

Do I need to declare in my Visual BASIC module that I allow the setting of cells in the spreadsheet (I don''t have protection on in my worksheet).

I am using Microsoft Visual BASIC 6.0 within Microsoft Excel 2000

Thanks for the help.

All the best,


Victor

推荐答案


大家好,


我在Excel电子表格中使用类似于我的模块中的VB语句设置单元格值(或fromat或...)时遇到一些问题:

范围(" C1)。值= 20


我在一个函数中有这个。如果我处于调试模式并且在该行处具有断点,则可以看到何时将鼠标悬停在Range(C1)上。该单元格中的实际值(在我的情况下为30),但是当我想要进入下一个语句时,VB程序结束(由于某些错误?)。

单元格值未更改到20岁。


有人能帮帮我吗?我尝试了其他几种方法来改变细胞,比如Range(AtmosProfile)。细胞(1,3).Value = 2 * 5

但这也行不通......


我是否需要在Visual BASIC模块中声明我允许在电子表格中设置单元格(我的工作表中没有保护)。


我在Microsoft Excel 2000中使用Microsoft Visual BASIC 6.0


感谢您的帮助。


一切顺利,



Victor
Hello all of you,

I have some problem in setting cells values (or fromat or...) in my Excel spreadsheet using a VB statement like within my Module:
Range("C1").Value = 20

I have this in a function. If I am in debug mode and have a breakpoint at this line, I can see when hovering my mouse over "Range("C1").Value" the actual value in that cell (in my case 30), but when I want to step to the next statement, the VB programs ends (due to some error?).
The cell value is not changed to 20.

Can someone help me? I tried several other methods to change cells, like Range(AtmosProfile).Cells(1, 3).Value = 2 * 5
but also this does not work...

Do I need to declare in my Visual BASIC module that I allow the setting of cells in the spreadsheet (I don''t have protection on in my worksheet).

I am using Microsoft Visual BASIC 6.0 within Microsoft Excel 2000

Thanks for the help.

All the best,


Victor



hi -


也许你可以省略关键字VALUE 。见下文

hi -

Maybe you can omit the keyword VALUE. See below

展开 | 选择 | Wrap | 行号



也许你可以省略关键字VALUE。见下文
Maybe you can omit the keyword VALUE. See below
展开 | 选择 | Wrap | 行号


spreadsheet1.cells(1,1).value =" hello"


该方法应该有效。
spreadsheet1.cells(1,1).value = "hello"

that method should work.


这篇关于通过Visual BASIC设置Excel cell.value的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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