Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
jkg jkg is offline
external usenet poster
 
Posts: 3
Default Worksheet_Change with discontinuous cells

Hi,

I'm working on a commission calculation form. At present, all calculation
rows are hidden until they click "Calculate Commission" (presumably after
they enter all the information...). That unhides the appropriate rows and
shows the calculations. But if they change certain cells, the macro needs to
be run again (as the rows that are shown depend on the choices, and if they
change those choices, different rows may need to be shown/hidden).

There's probably a simpler way to do this, but what I'm thinking of now is
writing code under the worksheet_change event with the target being the
particular cells that would prompt a need for recalculation. Only those cells
aren't continguous. For example, they are
A11
A12
A13
B6
B19
E19
G19

Is there a way to make the target these multiple ranges?

Or if you have a suggestion of a better way, in general, to handle this,
please fire away! My programming experience is mostly in Access, so I'm
struggling with some of the Excel stuff.

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Worksheet_Change with discontinuous cells

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A11:A13,B6,B19,E19,G19")) Is Nothing
Then
With Target
'do your stuff
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This i

--
HTH

Bob Phillips

"JKG" wrote in message
...
Hi,

I'm working on a commission calculation form. At present, all calculation
rows are hidden until they click "Calculate Commission" (presumably after
they enter all the information...). That unhides the appropriate rows and
shows the calculations. But if they change certain cells, the macro needs

to
be run again (as the rows that are shown depend on the choices, and if

they
change those choices, different rows may need to be shown/hidden).

There's probably a simpler way to do this, but what I'm thinking of now is
writing code under the worksheet_change event with the target being the
particular cells that would prompt a need for recalculation. Only those

cells
aren't continguous. For example, they are
A11
A12
A13
B6
B19
E19
G19

Is there a way to make the target these multiple ranges?

Or if you have a suggestion of a better way, in general, to handle this,
please fire away! My programming experience is mostly in Access, so I'm
struggling with some of the Excel stuff.

Thanks!



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
Average range of discontinuous cells Nadine Excel Worksheet Functions 1 May 11th 10 07:14 PM
sum value of nonblank discontinuous cells stumped New Users to Excel 3 February 29th 08 03:27 PM
SumIf with discontinuous cells? RBee Excel Discussion (Misc queries) 6 September 29th 06 04:38 PM
Allow pasting as a value to several discontinuous cells at once. Harveywater Excel Discussion (Misc queries) 1 July 7th 06 08:52 AM
Can an array be made of discontinuous cells of the same row? vanillawand Excel Discussion (Misc queries) 0 February 3rd 06 11:20 AM


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

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

About Us

"It's about Microsoft Excel"