#1
|
|||
|
|||
specifying a cell value from another cell and a constant
I've assumed this was working just fine for many months. The VBA code is used in conjunction with Excel Solver, but that shouldn't be important for this question. To specify the value of, say, cell "Ai", where "i" is a positive integer, I have:
ActiveSheet.Range("$A$" & i).Value = "$R$42" & "-140.5" It suddenly appears that this is NOT giving me what I thought it was...a numerical value. BTW, cell R42 is currently = 209. So I thought this expression was setting cell "Ai" to 68.5. But now, it appears that it is simply an expression, perhaps a string or variant. This sounds ridiculously simple, but can someone please tell me how to specify a numerical cell value, in VBA, as the sum of another cell value and a constant? Thanks a lot, ahead of time! |
#2
|
|||
|
|||
If you are putting a sum into a cell then I think all that's missing is your equals sign.
Code:
ActiveSheet.Range("$A$" & i).Value = "=$R$42" & "-140.5" |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Change formula cell range based on cell value | Scoth | Excel | 4 | 10-25-2012 07:51 AM |
Keep cell in formula constant | jprt68 | Excel | 1 | 06-26-2012 08:31 AM |
How can I fill cell color starting from Cell D5 using Conditional formatting instead | Learner7 | Excel | 0 | 07-08-2010 05:50 AM |
How can I make a cell color RED under the Today's date cell? | Learner7 | Excel | 2 | 07-08-2010 12:52 AM |
Auto-populate an MS Word table cell with text from a diff cell? | dreamrthts | Word Tables | 0 | 03-20-2009 01:49 PM |