Hi
I'm currently working on a small system where Excel has some rows to calculate. I wont explain in details what is should do, but when i run my VBA is says the error in the title of my thread.
How my code looks:
And.Code:Sub ny() Private Sub Worksheet_Change(ByVal Target As Range) Dim total As Integer total = Application.Sum(Sheets(1).Range("A14:I14")) If total = 227 Then Application.GoTo Sheets(1).Range("A17"), True End If End Sub
Is it possible to put more codes in one macro? Like as you see A14:I14 should be 227, and so. Can i put more of the same stuff in, so A15:I15 should be 225. So i only has to enable 1 macro at the time.
Last edited by Leeboy; 03-18-2010 at 01:44 PM.
If this is a macro that is supposed to activate itself, then remove the first line of code, it's redundant. the ws_change line should be first.
Also, this macro goes in the Sheet module itself, not a regular module (Module1 or Module2, etc.)
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
I'm not all sure I get what you mean. I have tried to edit some of the stuff, but it comes with a syntex error, or again, with the Expected End Sub.
What I wan't is to put in alot of different codes, and then activate the one macro.
Later disable the macro and start a new macro.
How it looks
image here
I want the small tables under to activate when all the numbers in one line are picked.
The big plate with all the numbers will be empty and filled out with the numbers you pick later on.
So by calculating the total amount of each line i can make the macro go to a specefic place when the amount is reached.
I know how to reach the amount and so, but the macro wont work as it should >.<
This thread is about the END SUB error. Don't get your two threads mixed up.
Take out this line of code:
Code:Sub ny()
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
If that takes care of this thread, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
You shouldn't post a new problem in an existing thread (especially not one which is 2.5 years old), but if you look at the thread you'll find that your answer is in there (hint: you open sub Option1 and then try to open another sub without closing Option1 first).
Andrew, I think you posted in the wrong thread, no activity here.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks