Macros Following The Call Stack In Reverse
Apr 3, 2007
I am trying to determine if anyone has seen a problem like the one I am about to describe. I have created a huge Excel Program with multiple modules and and several macros in each module. Each macro performs a function and then hands of to the next macro. The overall program is sometimes required to go back through almost the entire process once or twice depending on the data it is handling. My problem is that at the end of the procedure, when the last macro runs and gets to the final End Sub, instead of shutting down, it starts going back through the other end subs of the previous macros. I have toggled it one move at a time and it goes from the last macro, back through each of the previous macros, following the call stack in reverse order. in some cases, it will go to the end sub, and then go through the last commands that it went through in that particular macro, repeating steps already taken and devestating the data with orders that should not be repeated. It finally will lock upwhen it gets to a place where an order is given for the macro to go someplace that no longer exist due to previous, PROPER macro execution. Has anyone here ever seen any behavior like this out Excel? The only time this does not happen is when the data the program its handling does not require Excel to repeat its travel through the macros a second or third time.
View 9 Replies
ADVERTISEMENT
Jul 12, 2006
how to print the call stack?
View 3 Replies
View Related
Aug 29, 2006
Can someone please help? I am very new to vba but I have managed to write code ( multiple subs strung together with Call statements) for about 25 sheets in this one workbook. Each sheet has a command button that initiates the data maipulation that I want to accomplish on that particular sheet. It all works very well when I go to each sheet and click on the command button.
Now I want to make all of these processes run from one command button on the first sheet. All of the subs on every sheet now have unique names because I anticipated wanting to string them all together and run them from one command button. I guess you call this a module for the entire workbook, but I am still struggling with the terminalogy of all this programming, so don't know for sure.
I added the code from the second sheet/command button to the end of the code from the first sheet/command button and joined them with a Call statement. Figured I would go about this sistematically, sheet by sheet. Instantly, I got an error message " Activate method of range class failed" when I ran it. At the start of the added code, I had added something like Worksheets("Sheet2").Activate figuring that I needed to activate that worksheet in order to make the rest of the code work. That is where I got the error.
Sorry for the long winded explanation. Can someone tell me what I need to add/do in order for the code to run without error as I string together all the pieces from each sheet?
View 6 Replies
View Related
Oct 9, 2006
I have a value in a cell named subNo. whatever that value is I want that routine to be called. How do I concatenate Sub & the number?
Sub WhichSub()
Dim varSubNo As Integer
Dim mysub As String
varSubNo = Sheets("Main").Range("subNo").Value
Call Sub & varsubNo 'how do I concatenate this?
End Sub
View 5 Replies
View Related
May 14, 2014
Macro which loops through a number of files and calls the same macro in each of them. Unfortunately when I add "Application.Run..." to the code, it no longer loops through the process and instead stops after updating the first file in the loop. If I remove the "Application.Run..." code and add any other code, the loop works fine and it continues through the process repeating all the steps for each file found.
Why it stops after one file when using "Application.Run..." to call the macros?
NB I have a list of path and file names starting in row 8 of columns A and C. Each file in the list has a macro called UpdateS1 and promoupdate1.
Sub C_Run_Loop_Macro()
Dim lastRow As Long
Dim i As Long
[Code]....
View 4 Replies
View Related
Oct 2, 2013
I want to call a macro with a varying name that is within a module with the same name.
I have a module called Test1 and within this, a macro name called test1
I have a module called Test2 and within this, a macro name called test2
etc
On another module called Test8 (with the macro called Test8), this Test8 macro will call either Test1 or Test2 or Test3 etc depending on what I choose in an excel spreadsheet. So on sheet1, cell A1, there is a drop down with the options Test1 or Test2 or Test3 etc.
The following works to run the macro test1 from module test1 (when it does not vary i.e. i physically put in the name of the macro myself):
Sub Test3()
Test1.Test1
End Sub
The following works to run the macro test2 from module test2 (when it does not vary i.e. i physically put in the name of the macro myself):
Sub Test3()
Test2.Test2
End Sub
etc
However, if I try it so that the calling of the macro varies as below , it does not work:
Sub Test3()
MacroToCall = Sheets("Sheet1").Range("A1").Value
MacroToCall.MacroToCall
End Sub
View 7 Replies
View Related
May 21, 2006
I have a work book with 3 sheets. Sheet 1 is the main sheet and sheets 2 and 3 will use (I hope vlookup) to update 3 columns from info in sheet 1. my attempt at a vlookup call in sheet 2 is: =VLOOKUP($b3,[master_AoJ_2.xls]Sheet1!$B$3;$B$65,false)
my understanding is that: - $b3 is the cell in sheet 2 that will be updated as a result of the vlookup call. - [master_AoJ_2.xls]Sheet1!$B$3;$B$65 refers to range $B$3:$B$65 on sheet1 of master_AoJ_2. it does not work... infact I get nothing at all. when I type the call into cell $b3 of sheet2 excel thinks it is stariaght text. this is how I coded the function call =VLOOKUP($b3,[master_AoJ_2.xls]Sheet1!$B$3;$B$65,false)
View 4 Replies
View Related
Dec 18, 2009
I am trying to write a formula to reverse data in a cell. Basically I am converting a number to hex then I want to take that hex string and reverse it. So it would be something like this my original number is 400001001 my hex number would be 17D787E9 because I am only allowing it to show 8 characters. I want to reverse the 17D787E9 to read 9E787D71.
My question is: How can I reverse that cell? I have searched google and this forum and can't seem to figure it out. I am sure I could do it in VB but I don't know any VB code.
View 5 Replies
View Related
May 6, 2009
I'm running into an overflow stack with a fairly large MACRO program. Will chopping the VBA MACRO into call routines reduce the stack size of the MACRO?
View 9 Replies
View Related
Jul 16, 2008
I'm running a while loop and after about 3000 iterations get this error:
"Out of stack space"
View 11 Replies
View Related
Aug 28, 2009
See attached. I want to use column A to create column B (the expected result) by way of a formula. Index?
View 6 Replies
View Related
Aug 21, 2013
I added some code I got today and now when it runs i get the code 28 out of stack space.
Basically when the If has determined which macro to run, once that macro has ran that should be it.But if deletedates2 has ran, it reverts back to deletedates and starts again, then I get the error:
Sub deleteDates()
Dim sh As Worksheet
Dim lr As Long
Application.ScreenUpdating = False
'# Determin if (O:O) has been deleted#'
If Application.CountA(Range("$O:$O")) = 0 Then
Call DeleteDates2
[code].....
View 6 Replies
View Related
Jan 30, 2007
Is there a way to stack toolbar buttons on two rows instead of one row?
I have a floating toolbar that is created when a workbook is opened. The toolbar has 16 buttons (all in a row) and gets in the way because it is too long.
I would like to display the toolbar with two rows of eight buttons instead of one long row of 16 buttons.
Is there a way to create a floating toolbar that when created will display the first eight buttons and then “wrap text” /”carriage return” itself and then display the final eight buttons?
View 3 Replies
View Related
Jan 5, 2009
I have 65,000 rows of numerical data in column A. In column B are selected values from A. I need to put values from non empty cells in column B to C and "stack" them in a contiguous column with no empty cells. (Please see attached).
View 3 Replies
View Related
Feb 6, 2012
I am trying to run the following code, but when it executes, I get a stack overflow message....
Application.DisplayAlerts = False
Sheets(client_id).Delete
Application.DisplayAlerts = True
View 6 Replies
View Related
Jul 25, 2006
I've got this code to display a certain cell from multiple files, and functionally it works, but I get a out of stack space error after it runs for a while. I'm sure this is because the loop doesn't know when to stop, which I thought would be solved by having " Do Until sBook = "" " instead of Do; however, then the code will not run at all.
Private Sub Worksheet_Calculate()
Dim sBook As String
Dim sFilePath As String
On Error Resume Next
Application.EnableEvents = False
Roe = 3
Do
View 3 Replies
View Related
Apr 30, 2013
I have a spreadhseet with lots of sheets. Instead of scrolling across to see ones out of view, it would be really neat if the view of the sheets could be stacked to show them on multiple rows.
Can this be done?
VBA is an option if I need to go down that route.
View 3 Replies
View Related
Oct 17, 2008
Here is my scenario, I have the following data:
Data Series 1
a=3
b=3
c=4
Tot 10
Data Series 2
d=2
e=2
f=2
g=1
h=1
i=1
j=1
Total 10
Data series 3
k=4 (d+e)
l=3 (f+g)
m=2 (h+i)
n=1 (j)
I want the three stack bars together, for the series 2 & 3 I want them without any gap so I can see how data series 3 is created.
I can't find a way to create a three stack bars chart that don't have the same number of data series, I don't want percentages.
View 9 Replies
View Related
Oct 21, 2008
the code i have got is attached below but the problem i am having is when i enter the letter "H" which is calculated in AJ and i enter it fast it comes up with the error "Out Of Stack Space error 28". AJ in the code below is where the cumlative value is stored, and AI is the value that it is measured against it AJ is greater than AI the message is displayed.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rRow As Range
Dim icolor As Integer
Dim ifont As Integer
With Application
.CellDragAndDrop = False
.CutCopyMode = False
End With
If Intersect(Target, Me.Range("TABLE1")) Is Nothing Then Exit Sub
Me.Calculate
For Each rRow In Target.Rows
If Me.Cells(rRow.Row, "AJ") > Me.Cells(rRow.Row, "AI") Then
rRow.ClearContents
MsgBox "No Holidays Left or No Holidays setup Against Them " & Me.Cells(rRow.Row, "AI") & " days."............................
View 9 Replies
View Related
Aug 26, 2009
I have an Excel 2003 program that contains macros. One of the macros hides certain command bars and disables the worksheet menu bar. On close the opposite is true. The problem is, if a user uses the disable macros when opening then the worksheet menu bar and other command bars are still available. I would like to hide all of the data sheets and display another sheet that would normally be hidden displaying a message that the macros have to be enabled for the program to work correctly if disable macros is chosen. When the enable macros are used I would like the Error page to be hidden.
View 6 Replies
View Related
Mar 9, 2012
I have columns A through AKP (A:AKP) with data, and there is a varied number of rows for each column. If possible, I need a macro that will "stack" columns in pairs of two. For example, column "C" directly under column "A" and column "D" directly under column "B" and so on for all columns A:AKP.
This is an example of what my data looks like:
COLUMN A COLUMN B COLUMN C COLUMN D
ROW 1 2598 F800 2599 F800
ROW 2 2598 K1300 2599 K1300
[Code].....
View 3 Replies
View Related
Apr 1, 2008
i was hoping to get advice from anyone familiar with the "out of stack space" error. basically i'm building a UserForm-based app which reads spreadsheet data and stores it as a module-level variables (well, an array). the different buttons lets you edit the variable, and once you're done it writes back to the spreadsheet.
at least, that's the idea - lately i've been running into a lot of "out of stack space" errors, which have been pretty hard to pick out because my app's grown to the size where it's not so easy to pick out the root of the problem. what happens is the app will let you perform operations on the data with no error, but after repeating the operations too many times the application tells me i'm out of stack space. i've read up a bit on the error, and here's the list of possible causes i'm using as reference: Out of stack space (Error 28)............
View 3 Replies
View Related
Jul 28, 2008
I have a user that keeps a maintenance log in an Excel worksheet and sends an updated copy once a week to a board member. Two weeks ago, the board member started complaining that he was prompted to enable/disable macros on opening and became worried when my user stated that no macros were used in the book. He is now concerned that we have sent him a virus.
I know the file is clean because I've scanned it, and when I look at the file in VB, there are no modules or classes present just the Sheets 1-3 and the ThisWorkbook file. None of these objects have any code in them. My user does have some macros in PERSONAL.XLS but they are not used in the workbook in question.
No one else gets the prompt for enabling/disabling macros. Even if I set my security to prompt for any macros, I get no message. I'm convinced that there must be some setting in his Excel that is causing this individual to get this message. Is there anything else other than a macro that would cause this?
View 9 Replies
View Related
Sep 11, 2008
I've written a list and I want it the other way around. Top at the bottom, bottom at the top.
There's no sortable column in it. If it gets sorted it'll be out of order. I just want the same order but reverse the whole thing.
I've looked around a lot and failed to find it so far.
I've got to do is add a column at the side, number it in order then sort on that column, remove it later, right?
View 7 Replies
View Related
Apr 27, 2009
I need a formula that would search a string in a cell for spaces starting from the right. similar to MID but with the start and end pos reversed.
eg. col A below stores the text. col B to D is where i need to write the formulaes and drop down for the number of rows in A (in this case 3)
A
33 444 555
444 55 666
666 777 98 88
here is what the result in cols B C and D should be after the formula and drop down:
B
555
666
88..................
View 4 Replies
View Related
Feb 18, 2010
I'm fairly proficient in Excel, but this one has me stumped (I have attached a spreadsheet to show what I'm talking about): For example, take these two rows of data:
55 , 105 , 101
4 , 3 , 1
The first row represents the production level in years 1, 2, and 3 of production of the life of a unit. The second row represents the number of units added in a particular year. So, if you are in the third year, the one unit added that year will produce 55 widgets, the three units added the previous year will each produce 105 widgets, and the four units added two years ago will each produce 101 widgets.
So: 1*55 + 3*105 + 4*101. The result for this formula would go underneath the "1" (ie its the total production in year 3, from all those units added in years 1-3).
Then when we roll through to the fourth year, where 2 units are added (and where we have the extra info that in the fourth year of production, a unit produces 50 widgets) it looks like this:
55 , 105 , 101, 50
4 , 3 , 1, 2
2*55 + 1*105 + 3*101 + 4*50.
The result for this formula would go underneath the "2" (ie its the total production in year 4, from all those units added in years 1-4). I need to produce a single formula which I can drag across the row. Without having a single formula, I need to copy the formula across to the cell to the right (with "$" in the right places), then add a new element to it. Seems very inefficient (take a look at my attachment)
View 3 Replies
View Related
Oct 31, 2009
i have to reverse a very big wordlist containing four coulmns. Column A words, Column B Transcription, Column C Grammar and Column D Meanings. Now i would like to make the meanigs (seperator is ";") to words and words to meaning in another new worksheet added by a macro. For example English-French would then become French-English wordlist.
If the original worksheets name is "x" then a new worksheet should be added with name "Re-x". This new sheet should then contain the new wordlist. For example:
View 12 Replies
View Related
Oct 7, 2008
I know how to do two-way lookup with the INDEX and MATCH functions (example, =INDEX(B2:H11,MATCH(A6,A2:A11,0),MATCH(E1,B1:H1,0)) to lookup a value in a table given a value in the row range and a value in the column range. I also know how to use the space intersector to do a two-way lookup (example, =A6:H6 E1:E11).
My question is, is it possible to do the reverse. Instead of finding the row and column positional and then returning the value at the intersection of the two, is it possible to have the value at the intersection and then find the two values in the row and column positions? So this would mean somehow returning two values in two cells.
View 9 Replies
View Related
Jan 7, 2009
I have a column, call it E.
I have table, call it Cities. It has a column of, um, cities, but entered in various ways; and a column of regions:
South Cumberland SW
So. Cumberland SW
So. Cumb. SW
Cumberland SW
Galveston S
Rangeley NE
Galv S
If any one of the entries in Column 1 is contained in column E, I want my formula to return the appropriate region code for each row of E.
Note that E8 may or may not be an exact match for the table entry - it may have additional text before and/or after the match text. It may also not appear in the table at all.
I could contruct a whole sequence of "Find" formulae, but I'm thinking there has to be a better way. Also, if I find I need to add another city permutation, it's way easier - & less error-prone - to just extend the table than to create a whole new "Find" calculation column, and then add that column into the calculation that extracts the region.
View 9 Replies
View Related
May 22, 2009
I need to reverse concatenate a column of addresses, but text to columns won't work. I'd like to have a formula that takes into account each of the following scenarios (basically any standard address you can think of):
102 Bart St
104 Homer Simpson Ave
106 US HWY BSN 805 W
108 N Springfield Rd
What I need is to have the result in four columns. The first field would the house number. The second column would be the prefix (direction) of the street name, IF PRESENT (so the first three examples would have no value in the second column, but the fourth one would have an "N". The FOURTH column would have the suffix, whether that is a street type (like Rd or Ave), or a post-directional like in the third example ("W"). The THIRD column would have everything else (whatever is between the prefix and the suffix). In other words, using the examples above (* indicating a new column):
102**Bart*St
104**Homer Simpson*Ave
106**US HWY BSN 805*W
108*N*Springfield*Rd
View 9 Replies
View Related