Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
| Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 4th, 2007, 07:20 PM
Registered User
 
Join Date: Jun 2007
Location: Cairo, Cairo, Egypt.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Question about " Calculate " in VBA Excel ?


Hello ; How are you today ? and thank you for your help

as you know we can put our order under
Sub Worksheet_Calculate ()
###
End Sub

and our Order will happen when Calculation in any cell update
in our Excel worksheet .

But I want add a specific action ...

So, When Calculation is updated in cell " A1 "
program makes response ... like order or statement

But When Calculation is updated in Cel " A2"
Porgram makes another response ... like order or statement

Can I do that and How ?

thank you

Jake Anderson
 
Old July 5th, 2007, 01:07 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Why can't you try the following ?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim sAdd

  sAdd = Target.Address

 If sAdd = "$A$1" Then

    ' Some stuff

 ElseIf sAdd = "$A$2" Then

    ' Some other stuff

 End If

End Sub


Hope it comes good

Cheers
Shasur

http://www.dotnetdud.blogspot.com
 
Old July 5th, 2007, 08:37 PM
Registered User
 
Join Date: Jun 2007
Location: Cairo, Cairo, Egypt.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default


thank you

But this code works only with
SelectionChage and Change

I want code that can work with calculate :

EXAMPLE :

If A1 = A2 + A3
and B1 = B1 + B2

when the value of A2 , A3 , the value of A1 will update
so, this will active the calculation of excel sheet .

I want code that can determine the excel cell that is calculated
and enter the new value of A1 to my data base :

Code EX :

If ## Cell "A1" Calculate Update ## then
## Enter A1 Value to DataBase ##
ElseIf ## Cell "B1" Calculate Update ## Then
## Enter B1 Value to DataBase
End IF


Can I do that Shasur ?

thank you fot your great help




Jake Anderson
 
Old July 9th, 2007, 01:20 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Can you try out something using the Workbook_SheetCalculate event.

This event fires every time for calculation in any of the sheet

Try if You can use the Sh object in this event to get the cell. I will also let you know once I get it

Cheers
Shasur



http://www.dotnetdud.blogspot.com




Similar Threads
Thread Thread Starter Forum Replies Last Post
Code works in Excel VBA but not Access VBA fossx Access VBA 2 May 21st, 2007 08:00 AM
Converting excel data to Access using excel VBA ShaileshShinde VB Databases Basics 1 April 26th, 2006 07:57 AM
Word VBA question mcinar VB How-To 5 April 18th, 2005 03:19 PM
A simple question about date in VBA for Excel 2002 Trancefuzion Excel VBA 2 July 29th, 2004 04:37 AM
Excel VBA to SQL & back to VBA edesousa Excel VBA 1 June 1st, 2004 02:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.