Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Calculations

In MS Access I was able to do

if A + B = C then
do action
else
do another action
end if

Can I do the same in Excel for example:

if Cell.A1 + Cell.A2 = Cell.A3 then


What would the VBA look like?
Thank you for your time,
Ryan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Calculations

One way

If Range("A1") + Range("A2") = Range("A3") Then
'do things
Else
'Do different things
End If

Mike

"Ryan W" wrote:

In MS Access I was able to do

if A + B = C then
do action
else
do another action
end if

Can I do the same in Excel for example:

if Cell.A1 + Cell.A2 = Cell.A3 then


What would the VBA look like?
Thank you for your time,
Ryan

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Calculations

I did this using several variations so you can see that there is more than
one way to skin the cat.

sub doit()
if range("a1")+cells(2,1)=cells(3,"a") then
msgbox "OK"
else
msgbox "not ok"
end if

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ryan W" wrote in message
...
In MS Access I was able to do

if A + B = C then
do action
else
do another action
end if

Can I do the same in Excel for example:

if Cell.A1 + Cell.A2 = Cell.A3 then


What would the VBA look like?
Thank you for your time,
Ryan


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Calculations

A neat way to demonstrate 3 ways :)

"Don Guillett" wrote:

I did this using several variations so you can see that there is more than
one way to skin the cat.

sub doit()
if range("a1")+cells(2,1)=cells(3,"a") then
msgbox "OK"
else
msgbox "not ok"
end if

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ryan W" wrote in message
...
In MS Access I was able to do

if A + B = C then
do action
else
do another action
end if

Can I do the same in Excel for example:

if Cell.A1 + Cell.A2 = Cell.A3 then


What would the VBA look like?
Thank you for your time,
Ryan



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
#N/A in calculations JonR Excel Worksheet Functions 6 September 10th 06 07:33 PM
Calculations seem to be off... RUSH2CROCHET Excel Discussion (Misc queries) 3 June 6th 06 05:22 PM
! in Calculations Strata Excel Discussion (Misc queries) 4 December 14th 05 01:15 PM
Help with PV calculations PJF Excel Worksheet Functions 2 October 30th 05 01:04 AM


All times are GMT +1. The time now is 04:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"