Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA Class Objects - Parent & Successor Objects

Good Afternoon,

I would greatly appreciate any assistance relative to the following
Class object related objective:

1. I would like to define a Class of Objects based on the presence of
various Data Validation Lists in certain cells, and be able to fire
code based upon the worksheet calculate event whenever a member of the
class is changed by the user.

I think I understand the basics re Class objects, in that they enable
you to define a custom set of procedures, properties and methods for an
object or a collection of objects. However, I am struggling witht the
syntax.

If one of you kind folks could provide some code that achieved the
following AIM, it would greatly assist me with understanding classes.

1. I have a worksheet with numerous data validation list cells. I want
the user to be able to select from the following text strings, and in
response to the user's choice, have the formatting for the cell
directly to the right of the data validation list cell update according
to user selection.

Data Validation List Component ("G27"): Amount Input Cell ("H27"):
"$ Per Land SqFt:" If G27="$ Per
Land SqFt:", number format H27 = $#.00
"$ Amount:" If G27="$
Amount:" number format H27 = $#,###0
"% Land Cost:" If G27="% Land
Cost:" number format H27 = #.##0%


Rather than loop through all the cell testing for the presence of these
strings, and offsetting(0,1) to apply the format, it seems like a Class
of Worksheet Cells would be more efficient and enable me to do more.

Please advise! Thanks! - Walker

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel VBA Class Objects - Parent & Successor Objects

I don't see any reason to add complexity when selection in the list triggers
the Change event:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 then exit sub
If Target.Column = 7 then
Select Case Target.Value
Case "Something1"
Target.Offset(0,1).NumberFormat = "#,##0.00"
Case "Something2"
Target.Offset(0,1).NumberFormat = "$ #,##0.00"
end Select
End if
End Sub


--
Regards,
Tom Ogilvy

wrote in message
ups.com...
Good Afternoon,

I would greatly appreciate any assistance relative to the following
Class object related objective:

1. I would like to define a Class of Objects based on the presence of
various Data Validation Lists in certain cells, and be able to fire
code based upon the worksheet calculate event whenever a member of the
class is changed by the user.

I think I understand the basics re Class objects, in that they enable
you to define a custom set of procedures, properties and methods for an
object or a collection of objects. However, I am struggling witht the
syntax.

If one of you kind folks could provide some code that achieved the
following AIM, it would greatly assist me with understanding classes.

1. I have a worksheet with numerous data validation list cells. I want
the user to be able to select from the following text strings, and in
response to the user's choice, have the formatting for the cell
directly to the right of the data validation list cell update according
to user selection.

Data Validation List Component ("G27"): Amount Input Cell ("H27"):
"$ Per Land SqFt:" If G27="$ Per
Land SqFt:", number format H27 = $#.00
"$ Amount:" If G27="$
Amount:" number format H27 = $#,###0
"% Land Cost:" If G27="% Land
Cost:" number format H27 = #.##0%


Rather than loop through all the cell testing for the presence of these
strings, and offsetting(0,1) to apply the format, it seems like a Class
of Worksheet Cells would be more efficient and enable me to do more.

Please advise! Thanks! - Walker



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
A class with two objects? [email protected] Excel Programming 7 June 29th 06 02:34 AM
Nested Withs of Multiple Objects (Parent-Child) Trip[_3_] Excel Programming 0 November 3rd 05 08:52 PM
VBA & XL2K: Working with objects/class modules Mike Mertes Excel Programming 0 November 1st 04 02:55 PM
Unable to remove Sheet objects in the Microsoft Excel Objects Adrian[_7_] Excel Programming 1 August 26th 04 10:49 PM
new class w/ graphic objects Tony Rizzo Excel Programming 1 June 7th 04 02:18 PM


All times are GMT +1. The time now is 09:40 PM.

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"