Skud13 is correct.
You need to add a column to either record your last accepted bid (value), or whether you own the current bid (true/false). Then use that as a condition in your function.
Main Topics
Browse All TopicsI am writing a user function to raise my bid price for an auction. I want to make sure 1) I have the highest bid price, 2) I don't ever pay more than needed to have the best bid price and 3) that I don't compete with myself. Number 3 is giving me trouble.
Mugadu sent some code back that worked (thanks), but with some buttons and sub routines in it. I would like to make this work as a function if possible. Mainly because I am not sure how to reference/call the sub and I want the same function to work lots of times in a spreadsheet and don't want to get public/private mixed up. (I'm new to this...)
What am I missing to keep from competing with myself? When MyBid becomes the CurBid, I don't want to "raise" against myself.
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Tramtrak and Skud13,
When someone else out-bids me, the macro works and I up my bid. Problem is when my higher bid is sent I then up myself. Line 11 is meant to check if LSubmittedBid = CurBid, but each time CurBid is changed MyBid is zero (macro starts over?), so the check does not work as intented. This feels like it should be simple, but I am stumped.
Could someone show me how I can make conditional test in line 11 work? Where can I place or reference my old/previous MyBid value?
I assume that you are calling the MyBid function from a worksheet formula. It is therefore a user-defined function and not a macro.
It is worth noting that MyBid is 0 in statement 11. It only receives a value in statement 12. As a result, your If test will not work as intended.
I've added a parameter for your most recent bid in the function in the snippet below. I then use that value to initialize MyBid.
You'll also note that I changed all variable declarations to Double. This is because Excel VBA allocates space for a double precision number even when you specify Single in the Dim statement. There is thus no advantage to using Single. The same deal applies to integers--you should always use Long instead of Integer when declaring them because Excel allocates space for a Long anyway.
The final suggestion is that you will probably need to turn on Iterations using the Tools...Options...Calculat
Brad
Yes, this is a user-defined function rather than a macro.
I tried the iteration option to avoid the circular reference. But I still had the problem. I think I need to PASS MyBid to LastBid and pass it back into the code at the right time.
Can I do that in the same UDF? Or do I need a subroutine to "park" that old MyBid value? If so, how do I pass the value in and out when needed.
I am trying this myself, but I am slow at this....
Business Accounts
Answer for Membership
by: Skud13Posted on 2009-06-27 at 13:29:58ID: 24729115
Surely you already know what the value of your latest bid is. Therefore any other bid higher than your latest bid will be someone else. If you pass SubmittedBid As Single and put a condition If CurBid = LSubmittedBid then return without increasing the bid, MyBid = CurBid.