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


Hi,

I would like to have Excel multipling a number that I enter in a cel
by a factor 4 or 6 depending on the value of another cell (in the sam
row).
Meaning:
if I enter 1000 in G4 and hit Enter (or move to another cell) a cod
should run and check $B4 and if there is a "1000ML" it should multipl
by 6 and if there is a "1500ML" it should multiply by 4.

Any idea?

Tank

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default execute multiplication when data entry


I already tried the

Worksheet_SelectionChange
and
Worksheet_Change

functions but this ends eighter in a loop (calculate) or it changes m
cells always when I move from one to the other...

Any ideas??

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default execute multiplication when data entry

Goepf,

To use the WorksheetChange function without looping, try this:

Private Sub Worksheet_Change(ByVal Target As Range)
Static lockout As Boolean

If lockout Then Exit Sub
lockout = True

'Make your calculations here

lockout = False

End Sub


The 'Static' declaration means that the program 'remembers' the value of the
variable [lockout] between runs of the routine. Making a calculation in this
routine, and writing it to the sheet WILL cause another Change event, as you
have found, which needs to be locked out.

You can also use another technique which will disable the change event.

Application.EnableEvents=False
' Make Calculations here
Application.EnableEvents=True

HTH,
Alex J


"goepf" wrote in message
...

I already tried the

Worksheet_SelectionChange
and
Worksheet_Change

functions but this ends eighter in a loop (calculate) or it changes my
cells always when I move from one to the other...

Any ideas???


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to

creating financial statements


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default execute multiplication when data entry


Thanks Alex,

Now an additional question:

Is it possible to apply these code only for a section of the Worksheet?
Or do I have to test the "target" location before executing the
calculation?

Thanks so far!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default execute multiplication when data entry

geopf,

You will need to test Target to see if it is the right range to make a
change.

Opions would be (among others):

If Target.column = 3 Then .....
or
If Target.address = "$A$12" Then ...
or
(assuming you have a named range "MultRange" on the sheet)

Dim Isect as Range
Dim nmRng as Range
Set NamedRng =Sheets("Sheet1").Range("MultRange")

Set Isect = Intersect(Target, NamedRng)
If Not Isect Is Nothing then
'Do your calculation on the target cell(s) here
End if


Hope this helps.
Alex J

"goepf" wrote in message
...

Thanks Alex,

Now an additional question:

Is it possible to apply these code only for a section of the Worksheet?
Or do I have to test the "target" location before executing the
calculation?

Thanks so far!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to

creating financial statements


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
Data Entry Form - Execute if value is not 0 [email protected] Excel Discussion (Misc queries) 6 July 1st 09 04:57 AM
How to identify offset data and execute multiple formulas davensocal Excel Worksheet Functions 1 September 23rd 08 01:04 AM
Auto entry of data based on entry of text in another column or fie Judy Rose Excel Discussion (Misc queries) 2 May 21st 08 01:14 PM
Data Entry Online, Data Format, Data Conversion and Data EntryServices through Data Entry Outsourcing [email protected] Excel Discussion (Misc queries) 0 March 20th 08 12:45 PM
Cell Entry That Locks Selected Cells From Any Data Entry. ron Excel Worksheet Functions 5 February 16th 07 09:52 PM


All times are GMT +1. The time now is 09:08 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"