ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Subtract named cells (https://www.excelbanter.com/excel-programming/391145-subtract-named-cells.html)

FIRSTROUNDKO via OfficeKB.com

Subtract named cells
 
Hi,

Please can somebody help me with the formula for named cells

Partial code.........

Set Exp6 = Cells(H, 3)
Set Exp7 = Cells(I, 7)


ActiveCell.Offset(0, 1).Formula = "=exp6-exp7"

I just get #Name?

Thanks

Darren

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200706/1


Helmut Weber[_2_]

Subtract named cells
 
hmm...

Do you mean something like this:

Sub test()
Dim Exp6 As Range
Dim Exp7 As Range
Set Exp6 = Cells(1, 1)
Set Exp7 = Cells(1, 2)
ActiveCell.Offset(0, 1).Formula = "=sum(Exp6-Exp7)"
End Sub

--

Helmut Weber

Win XP, Office 2003


Helmut Weber[_2_]

Subtract named cells
 
"Sum" is not required

ActiveCell.Offset(0, 1).Formula = "=Exp6-Exp7"

--

Helmut Weber

Win XP, Office 2003


Bob Phillips

Subtract named cells
 
Cells(3,"H").name = "exp6"
Cells(7,"I").Name = "exp7"
ActiveCell.Offset(0, 1).Formula = "=exp6-exp7"

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"FIRSTROUNDKO via OfficeKB.com" <u15639@uwe wrote in message
news:7395be8a4cb7b@uwe...
Hi,

Please can somebody help me with the formula for named cells

Partial code.........

Set Exp6 = Cells(H, 3)
Set Exp7 = Cells(I, 7)


ActiveCell.Offset(0, 1).Formula = "=exp6-exp7"

I just get #Name?

Thanks

Darren

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200706/1





FIRSTROUNDKO via OfficeKB.com

Subtract named cells
 
Thanks for everybodys help.

Change of plan I think im going to show Exp6 and Exp7 then do the subtraction


Bob Phillips wrote:
Cells(3,"H").name = "exp6"
Cells(7,"I").Name = "exp7"
ActiveCell.Offset(0, 1).Formula = "=exp6-exp7"

Hi,

[quoted text clipped - 12 lines]

Darren


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200706/1



All times are GMT +1. The time now is 03:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com