小编Mr_*_*ags的帖子

为什么在VBA中使用Range.Formula for Excel 2003而不是Range.Value?

我想知道为什么在Excel 2003的VBA代码中我们甚至需要使用Range.Formula将公式写入单元而不是仅使用Range.Cell?他们都将字符串写入成为论坛的单元格,并且该公式起作用(从我测试过的).

ActiveCell.Value="=If(True,""yes"",""no"")"
Run Code Online (Sandbox Code Playgroud)

ActiveCell.Formula="=If(True,""yes"",""no"")"
Run Code Online (Sandbox Code Playgroud)

为我做同样的事情(当我选择一个单元格并在单独的单元格中分别执行上述每个代码段时).它们都在单元格中显示"是"值,并且当我单击以查看每个单元格时存储公式.

我查看了微软开发中心的信息:

Range.Formula Excel 2013的Range.Formula属性(Excel 2003没有此属性的页面)

Range.Value Excel 2003的属性(展开"应用于Range对象的Value属性."标题

我还搜索了"为什么使用Range.Formula而不是Range.Value VBA Excel"并找不到与我的问题相关的任何内容.

有人说,用Range.Value.

其他人说Range.Formula堆栈溢出使用(对不起,我丢失了对确切问题的引用......)

excel vba excel-2003 excel-vba

6
推荐指数
1
解决办法
9627
查看次数

在预编译头文件中包含头文件并在我的类头文件中包含头文件

我对此进行了一段时间的搜索,但我不断得到的答案无法回答这个特定的场景。

我有一堂课叫VisibleGameObject. 我想知道如果我将正常的包含放在标头中(以便其他开发人员可以使用相同的类),并将相同的包含放在我的预编译标头中,会发生什么stdafx.h 我不希望开发人员依赖于我的 pch。

// VisibleGameObject.h

#pragma once
#include "SFML\Graphics.hpp"
#include <string>

class VisibleGameObject
{
public:
    VisibleGameObject();
    virtual ~VisibleGameObject();

    virtual void Load( std::string filename );
    virtual void Draw( sf::RenderWindow & window );

    virtual void SetPosition( float x, float y );

private:
    sf::Sprite  _sprite;
    sf::Image _image;
    std::string _filename;
    bool _isLoaded;
};
Run Code Online (Sandbox Code Playgroud)

实施:

// VisibleGameObject.cpp
#include "stdafx.h"
#include "VisibleGameObject.h"

...
Run Code Online (Sandbox Code Playgroud)

个人计算机信息中心:

// stdafx.h
#pragma once

#include "targetver.h"

#include <stdio.h>
#include <tchar.h>


// TODO: reference additional headers your program …
Run Code Online (Sandbox Code Playgroud)

c++ include precompiled-headers

5
推荐指数
1
解决办法
590
查看次数

标签 统计

c++ ×1

excel ×1

excel-2003 ×1

excel-vba ×1

include ×1

precompiled-headers ×1

vba ×1