is_utf8:0,
 
Search : in
By :

Macro variable help

Last answer on May 15, 2009 8:09:54 pm BST nimesh, on May 14, 2009 6:13:30 pm BST 
 Report this message to moderators

Hello,

I have declared a variable

Dim x As String
x = Cells(x + 10, 10).Value

I am getting the value of a cell in x. I want to use that value in a sumif function which i have defined below

Cells(y,6).Formula = "=SUMIF(I25:I1000,& x &,F25:F1000)"

y is defined somewhere else so that is not a problem.

I keep getting a error here, how do i pass variable inside a sumif function.

Thanks for all your help

Configuration: Windows XP
Firefox 3.0.10

Best answers for « Macro variable help » in :
[VBA/VB6] My Documents + Environment Variables Show [VBA/VB6] My Documents + Environment Variables With VBA With VB6 Environment Functions Windows Variables Getting started As displayed in Windows Explorer, the My Documents folder appears to be in the root, but it is not the case. It...
Swapping two variables without using a temp variable Show Swapping two variables without using a temp variable Using pointers Making use of a Macro Using pointers #include void change(int *,int*); int main () { int a=2,b=5; printf("Before : a=%d,b=%d\n",a,b); ...
Replacing Variables in Bash/shell ShowReplacing Variables in Bash/shell Intro: Expression:Defininition Intro: First of all make sure that you the variable is defined before replacing it, or in other cases determine that it is not empty, and to initialize with a default...
Excel – Macro to detect and hide blank rows ShowExcel – Macro to detect and hide blank rows Issue Solution Note Issue I want a macro to unhide about 20 blank rows copy values into the top row then hide the remaining rows (some cells have fill though) then the next time it will...
Recover result of command in a variable ShowRecover result of command in a variable For specific reason, it is necessary to recover the result of a command (or back code) in variable to exploit the script later. Below are different examples: Syntax var = $...
Download Super Macro ShowSuper macro is a free software which allows to create macro under Windows in order to activate diverse automatic actions. Apart being free, this software is easy to use and requires no knowledge in programming. You just simply click buttons, then...
Environment variables ShowEnvironment variables An environment variable is a dynamic value loaded into the memory that can be used by several processes operating simultaneously. On most operating systems, the location of some libraries or of the main system executables may...
Spreadsheets - Conditional expressions ShowWhat is a Conditional Structure? Conditional structures are instructions that allow to test if a condition is true or not. Conditional structures may be associated together. To successfully execute these tests using logical functions, spreadsheets...

1

WutUp WutUp, on May 15, 2009 1:07:05 am BST

Looks like you need to add two more quotation marks.


Try this:

Cells(y,6).Formula = "=SUMIF(I25:I1000," & x & ",F25:F1000)"

Reply to WutUp WutUp

2

 nimesh, on May 15, 2009 8:09:54 pm BST

Thanks for your help, it worked but gave me a small problem. In the sumif function it got the exact value from the cell in excel but without the quotes "" in the sumif formulae due to which the sumif function returns a 0. How do i fix that.

Thanks for ur help

Reply to nimesh