Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default circular argument

I am trying to make a formula in a cell that will read the value the
user puts in the cell and multiply it by 40, giving me that as the cell
value instead of just the input.
I tried putting this in the cell
=d15*40 (in cell d15)
This gives me a circular argument error.
I suspect I might need to do it in vba, but where does it go in the vba.
I am still confused by the Change event on the worksheet and what all
goes there and how to line up the sequence of events. Oh my!
Thanks for any info you can give me
Joanne
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default circular argument

One way is to right click the sheet tab, view code and paste this in. It
works on cell A1 but If you want to apply this to a range of cells and don't
know how to modify it then post back.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A$1" Then
If IsNumeric(Target) Then
On Error Resume Next
Application.EnableEvents = False
Target = Target * 40
Application.EnableEvents = True
On Error GoTo 0
End If
End If
End Sub

Mike

"Joanne" wrote:

I am trying to make a formula in a cell that will read the value the
user puts in the cell and multiply it by 40, giving me that as the cell
value instead of just the input.
I tried putting this in the cell
=d15*40 (in cell d15)
This gives me a circular argument error.
I suspect I might need to do it in vba, but where does it go in the vba.
I am still confused by the Change event on the worksheet and what all
goes there and how to line up the sequence of events. Oh my!
Thanks for any info you can give me
Joanne

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default circular argument

THank you Mike
Yes I need it to run on a range of col d cells. Can I name the range and
use it in the code like this?
If Target.Address = RangeName Then

So this goes in the worksheet_change event. How does the excel ws know
in what order to run all the little snippets of coding that are in the
worksheet_change event? I guess I am a bit hung up on getting the code
in proper sequence so that it will run - it seems to this newbie that
that is not necessary in the change event? Am I correct?

Thanks for your help
Joanne

Mike H wrote:

One way is to right click the sheet tab, view code and paste this in. It
works on cell A1 but If you want to apply this to a range of cells and don't
know how to modify it then post back.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A$1" Then
If IsNumeric(Target) Then
On Error Resume Next
Application.EnableEvents = False
Target = Target * 40
Application.EnableEvents = True
On Error GoTo 0
End If
End If
End Sub

Mike

"Joanne" wrote:

I am trying to make a formula in a cell that will read the value the
user puts in the cell and multiply it by 40, giving me that as the cell
value instead of just the input.
I tried putting this in the cell
=d15*40 (in cell d15)
This gives me a circular argument error.
I suspect I might need to do it in vba, but where does it go in the vba.
I am still confused by the Change event on the worksheet and what all
goes there and how to line up the sequence of events. Oh my!
Thanks for any info you can give me
Joanne


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default circular argument

Joanne,

No you do it like this

If Not Intersect(Target, Range("D1:D100")) Is Nothing Then

You can extend or shorten the range as you require but this works on D1 - D100

I'm not quite sure what you mean by the second part of your question but
this may help.

Events happen whenever change is made in a worksheet/book and there are
several worksheet ones:-
Activate
Before double click
Change
etc

With regard to the worksheet change event it is fired every time the
worksheet changes and if there is any code in the event module then it is
executed. In our case when any cell is changed the event fires but the code
only does anything if it's the cells specified within the code that have
changed.

Have a look here where events are explained far better then I do.
http://www.cpearson.com/excel/Events.aspx

Mike

"Joanne" wrote:

THank you Mike
Yes I need it to run on a range of col d cells. Can I name the range and
use it in the code like this?
If Target.Address = RangeName Then

So this goes in the worksheet_change event. How does the excel ws know
in what order to run all the little snippets of coding that are in the
worksheet_change event? I guess I am a bit hung up on getting the code
in proper sequence so that it will run - it seems to this newbie that
that is not necessary in the change event? Am I correct?

Thanks for your help
Joanne

Mike H wrote:

One way is to right click the sheet tab, view code and paste this in. It
works on cell A1 but If you want to apply this to a range of cells and don't
know how to modify it then post back.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A$1" Then
If IsNumeric(Target) Then
On Error Resume Next
Application.EnableEvents = False
Target = Target * 40
Application.EnableEvents = True
On Error GoTo 0
End If
End If
End Sub

Mike

"Joanne" wrote:

I am trying to make a formula in a cell that will read the value the
user puts in the cell and multiply it by 40, giving me that as the cell
value instead of just the input.
I tried putting this in the cell
=d15*40 (in cell d15)
This gives me a circular argument error.
I suspect I might need to do it in vba, but where does it go in the vba.
I am still confused by the Change event on the worksheet and what all
goes there and how to line up the sequence of events. Oh my!
Thanks for any info you can give me
Joanne



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default circular argument

Thanks again Mike - you solved my immediate problem and given me some
understanding of the change event. I will follow the link and learn more
so I can better help myself.
Joanne
Mike H wrote:

Joanne,

No you do it like this

If Not Intersect(Target, Range("D1:D100")) Is Nothing Then

You can extend or shorten the range as you require but this works on D1 - D100

I'm not quite sure what you mean by the second part of your question but
this may help.

Events happen whenever change is made in a worksheet/book and there are
several worksheet ones:-
Activate
Before double click
Change
etc

With regard to the worksheet change event it is fired every time the
worksheet changes and if there is any code in the event module then it is
executed. In our case when any cell is changed the event fires but the code
only does anything if it's the cells specified within the code that have
changed.

Have a look here where events are explained far better then I do.
http://www.cpearson.com/excel/Events.aspx

Mike

"Joanne" wrote:

THank you Mike
Yes I need it to run on a range of col d cells. Can I name the range and
use it in the code like this?
If Target.Address = RangeName Then

So this goes in the worksheet_change event. How does the excel ws know
in what order to run all the little snippets of coding that are in the
worksheet_change event? I guess I am a bit hung up on getting the code
in proper sequence so that it will run - it seems to this newbie that
that is not necessary in the change event? Am I correct?

Thanks for your help
Joanne

Mike H wrote:

One way is to right click the sheet tab, view code and paste this in. It
works on cell A1 but If you want to apply this to a range of cells and don't
know how to modify it then post back.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A$1" Then
If IsNumeric(Target) Then
On Error Resume Next
Application.EnableEvents = False
Target = Target * 40
Application.EnableEvents = True
On Error GoTo 0
End If
End If
End Sub

Mike

"Joanne" wrote:

I am trying to make a formula in a cell that will read the value the
user puts in the cell and multiply it by 40, giving me that as the cell
value instead of just the input.
I tried putting this in the cell
=d15*40 (in cell d15)
This gives me a circular argument error.
I suspect I might need to do it in vba, but where does it go in the vba.
I am still confused by the Change event on the worksheet and what all
goes there and how to line up the sequence of events. Oh my!
Thanks for any info you can give me
Joanne






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
If argument DonaMil Excel Worksheet Functions 1 April 14th 10 04:20 PM
Circular or semi-circular chart DKS Charts and Charting in Excel 3 November 3rd 09 01:50 PM
Can I use the argument: - IF, AND, THEN, ElSE Newie New Users to Excel 2 June 14th 07 01:49 PM
if argument? Struggling of Essex Excel Discussion (Misc queries) 6 December 31st 05 09:48 AM
Function (array argument, range argument, string argument) vba Witek[_2_] Excel Programming 3 April 24th 05 03:12 PM


All times are GMT +1. The time now is 09:35 AM.

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"