Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-25-2014, 01:49 PM
ue418 ue418 is offline specifying a cell value from another cell and a constant Windows 7 32bit specifying a cell value from another cell and a constant Office 2000
Novice
specifying a cell value from another cell and a constant
 
Join Date: May 2012
Posts: 17
ue418 is on a distinguished road
Default 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!
Reply With Quote
  #2  
Old 08-25-2014, 10:24 PM
excelledsoftware excelledsoftware is offline specifying a cell value from another cell and a constant Windows 7 64bit specifying a cell value from another cell and a constant Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

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"
Reply With Quote
Reply



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
specifying a cell value from another cell and a constant 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

Other Forums: Access Forums

All times are GMT -7. The time now is 02:31 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft