topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 12, 2018, 03:11 AM
  • Proudly celebrating 13 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: My first excel macro  (Read 1168 times)

kalos

  • Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 1,691
    • View Profile
    • Donate to Member
My first excel macro
« on: October 09, 2018, 09:48 AM »
Hello!

I want to write a macro in Excel that will use the 'Goal Seek' analysis.

The code is something like that:

Range("Q27").GoalSeek Goal:=0, ChangingCell:=Range("B10")

As for input cell (ChangingCell), when the macro button is pressed, I want to consider the active cell. How can I do that?
As for the goal seek cell, I want to a formula to calculate it based on other cells values.

Any hint?

Thanks!

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 370
    • View Profile
    • Donate to Member
Re: My first excel macro
« Reply #1 on: October 09, 2018, 10:26 AM »
i do not want to scare some one off, i am sorry,
Spoiler
You really should consider to put your nose in a book.
If this is too expensive for you to learn, how about a visit to the public library?

Those are my Hints.
sorry bad english and Delphi are my hobby ;)
politeness is not one of my strengths in writing, just because it sounds rough doesn't mean that I mean it rough.
« Last Edit: October 09, 2018, 02:10 PM by KodeZwerg »

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 9,873
    • View Profile
    • Donate to Member
Re: My first excel macro
« Reply #2 on: October 09, 2018, 01:57 PM »
You really should consider to put your nose in a book.
If this is too expensive for you to learn, how about a visit to the public library?

Those are my Hints.

It's better not to answer, and let silence speak for itself, rather than to post snark, in my opinion.  DC remains a very open and inviting site, and some do seem not to help themselves.  But our responses to them can scare off others that we really could help.

kalos

  • Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 1,691
    • View Profile
    • Donate to Member
Re: My first excel macro
« Reply #3 on: October 09, 2018, 04:22 PM »
What I am asking is not a google search and I don't have the time now to read a whole tutorial

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 39,016
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: My first excel macro
« Reply #4 on: October 09, 2018, 04:37 PM »
It's better not to answer, and let silence speak for itself, rather than to post snark, in my opinion.  DC remains a very open and inviting site, and some do seem not to help themselves.  But our responses to them can scare off others that we really could help.

What Wraith said.  We must all remember to be kind and polite.  If you feel like someone should search for answer themselves, wither let your silence speak or give them some kind encouragement to go search for themselves... We try to avoid snark and sarcasm here, even though the current era we live in thrives on it.. it's just not the DC way :)

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 370
    • View Profile
    • Donate to Member
Re: My first excel macro
« Reply #5 on: October 09, 2018, 04:54 PM »
That was no sarcasm, that was meant kinda real, if i do not know something and have many questions to that subject, i go to library and rent a book or quick way, buy ebook.
If such possibilty is not available at your place, i am sorry.
But okay, i've taken your advice and keep my mouth better shut.
sorry bad english and Delphi are my hobby ;)
politeness is not one of my strengths in writing, just because it sounds rough doesn't mean that I mean it rough.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 39,016
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: My first excel macro
« Reply #6 on: October 09, 2018, 04:59 PM »
Don't keep your mouth shut, just infuse some kindness when you give advice, even if you might feel frustrated -- it makes new readers feel more welcome and comfortable.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 39,016
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: My first excel macro
« Reply #7 on: October 09, 2018, 05:31 PM »
The ironic thing is, this question from Kalos is one of his most reasonable and specific requests for advice, and a question that might not yield a quick easy solution with a google search.. Sounds like something someone might be able to give some advice about, or at least point him in the right direction..

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,688
    • View Profile
    • Donate to Member
Re: My first excel macro
« Reply #8 on: October 09, 2018, 05:45 PM »
for changing cell use 'ActiveCell'

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,288
  • Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: My first excel macro
« Reply #9 on: October 09, 2018, 05:54 PM »
At the risk of repeating myself:
@Stephen66515: "Ethics" is usually more about maintaining moral principles in behaviour and business. It would seem to be just plain rudeness/bad manners to tell people to "google it" or "RTFM", and my principles prevent me from being rude to others.
After years of lecturing, consulting and generally trying to maintain a politely helpful and positive approach to people's questions (including being a volunteer on aardvark), I eventually decided on three (sorry, four) basic rules:
Rule 1: that there is no limit to our ignorance (including mine), and I should accept that;
Rule 2: to limit the contribution of my cognitive surplus to such people and their infinite ignorance/questions, by encouraging them to take more responsibility for seeking out/discovering their own answers.
Rule 3: that people generally seem to have little respect for and to have a limited capacity to internalise answers/knowledge which have come too easily to them, so generally avoid giving them any answers.
Rule 4: in any event, avoid "telling them the answer" or pushing my opinion forwards without substantiation in theory, experience and good practice (this takes work to communicate).

When I have strayed from these rules, I have usually regretted it (I think it has happened once in the DC forum).

Therefore, rather than tell people to "google it" or "RTFM", IF I decide to assist them at all, then - and even if I think that I know the answer already - I nowadays usually google it, or check Wikipedia (say) or RTFM for them, and then send them the results or source links, with the suggestion that  they could probably get even more useful information if they hunted around a bit more themselves or played about with the google search string. This is just helping people to help themselves.

...RTFM is never an acceptable answer to any question. Because it is not an answer at all. It's just a thinly disguised way of telling someone to get lost. ...
...Consider: It only takes a few seconds to type RTFM and hit the enter key. But it takes exactly zero work to ignore something completely and go elsewhere. Ideally where you do have something real to contribute.


("Take a man up in a helicopter for a day and he will be able fly for a day. Push him out of the helicopter whilst it is flying and he will fly for the rest of his life."
 - ancient Chinese proverb.)
« Last Edit: October 09, 2018, 06:14 PM by IainB, Reason: Added 40hz quote. »

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,675
    • View Profile
    • Donate to Member
Re: My first excel macro
« Reply #10 on: October 09, 2018, 10:02 PM »
I want to write a macro in Excel that will use the 'Goal Seek' analysis.

Wow! For a giddy moment the topic title made me think you'd actually done something yourself... silly me.

Have you ever looked at Excel's built-in help?

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 8,592
    • View Profile
    • The Blog of Deozaan
    • Donate to Member
Re: My first excel macro
« Reply #11 on: October 09, 2018, 11:26 PM »
The ironic thing is, this question from Kalos is one of his most reasonable and specific requests for advice, and a question that might not yield a quick easy solution with a google search.. Sounds like something someone might be able to give some advice about, or at least point him in the right direction..

The Boy Who Cried Wolf comes to mind.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,042
    • View Profile
    • Donate to Member
Re: My first excel macro
« Reply #12 on: October 10, 2018, 09:29 PM »
... and a question that might not yield a quick easy solution with a google search..

And yet if a complete Excel agnostic, (ie. me), can find information within minutes using words from the OP, what should someone who uses Excel be able to do?

SearX

SearX

The Boy Who Cried Wolf comes to mind.

I don't think that's the problem, I don't mind how many times he asks for something because there are times when I learn something, (eg. the recent RegEx thread).

The main problem is the low quality questions and the almost complete lack of feedback/response to any suggestions/questions which are posed in order to get a clearer picture of what he's trying to achieve, ie. he's not interested enough to help us help him.

Have you ever looked at Excel's built-in help?
-cranioscopical (October 09, 2018, 10:02 PM)

Sounds suspiciously like RTM  :P
« Last Edit: October 11, 2018, 03:11 AM by 4wd »