VBA cell update

Questions about integrating Excel and Cymatic, programming, formulae, etc

VBA cell update

Postby stiggits » Thu Mar 10, 2016 1:13 am

Hi,

I am trying to update cells with VBA using the "Worksheet_Change" function,
but this seems to only work with manual changes.
Can someone tell me what I need to use for automatically updated cells.
Thanks.
stiggits
 
Posts: 14
Joined: Sat Aug 01, 2015 4:34 pm

Re: VBA cell update

Postby Gavin » Thu Mar 10, 2016 11:24 am

Hi stiggits,

Have a look at the Worksheet_Calculate function for automatically updated cells, which pplies when the resulting value of a formula changes.

Kind regards,

Gavin
User avatar
Gavin
Site Admin
 
Posts: 3835
Joined: Wed Jan 23, 2013 9:11 pm
Location: United Kingdom

Re: VBA cell update

Postby stiggits » Thu Mar 10, 2016 1:27 pm

Thank Gavin,
That seems to be working better now,
although it causes some issues with cell formulas which reference
cells in the code, but I think I can work around that.
Thanks,
Steve.
stiggits
 
Posts: 14
Joined: Sat Aug 01, 2015 4:34 pm

Re: VBA cell update

Postby Gavin » Sat Mar 12, 2016 12:18 am

Hi stiggits,

Glad to hear it :)


You can use the INTERSECT() function at the start of your WorkSheet_Calculate to decide whether to do your code based on whether certain cells caused Worksheet_Calculate to fire.

For example, something along the lines of:

Code: Select all
If Not Intersect(Target, Range("B4")) Is Nothing Then
---Do your code here----
EndIf


Search this forum (search box is in top right corner usually) for the word INTERSECT and you'll find other examples of it being used.

Kind regards,

Gavin
User avatar
Gavin
Site Admin
 
Posts: 3835
Joined: Wed Jan 23, 2013 9:11 pm
Location: United Kingdom


Return to Excel - Help / Support

Who is online

Users browsing this forum: No registered users and 0 guests

cron