Looping Macro Freezes Excel When Encountering Large Numbers Of Rows
Sep 15, 2009
We are attempting to use the macro below.
We believe that the problem is "memory related."
However, we can't find the correct workaround to the issue.
In Excel 2002, the behavior was for the macro to work great on small numbers of rows, but to just stop on large numbers of rows. After it stopped, the user would manually run the macro throughout the spreadsheet, by holding down Ctrl + N.
In Excel 2007, the behavior of the program is different, and Excel actually freezes up.
We've narrowed down the problem to be possibly "memory related."
However, we don't know the correct workaround for this.
For example, in the posting below (the referenced link) they suggest using "variant arrays" to address memory limitations type of issues ... but I'm not sure of how to implement those.
View 6 Replies
ADVERTISEMENT
Sep 15, 2006
I've managed to use some code I found to add a new row below the selected row, and duplicate all the forumlas of the source row. It worked fine dozens of times yesterday, but today it's decided not to work. It gets as far as creating the new row(s), but then just hangs & excel crashes before duplicating the formulas. I've even tried reverting to an earlier version, which also worked fine, but this crashes also!
Sub Add_New_Row()
' Unlock Worksheet
Worksheets("Sheet1").Unprotect Password:="*****"
Dim x As Long
ActiveCell.EntireRow.Select 'So you do not have to preselect entire row
If vRows = 0 Then
vRows = Application.InputBox(prompt:= _
"How many rows do you want to add?", Title:="Add Rows", _
Default:=1, Type:=1) 'Default for 1 row, type 1 is number
If vRows = False Then Exit Sub
End If
'if you just want to add cells and not entire rows
'then delete ".EntireRow" in the following line
Dim sht As Worksheet, shts() As String, i As Integer
Redim shts(1 To Worksheets.Application. ActiveWorkbook. _
Windows(1).SelectedSheets.Count)..................................
View 7 Replies
View Related
Nov 30, 2011
I have an intensive VB program I've written that the user kicks off by clicking a button. I update a particular cell near the button with progress numbers so they can see what's going on. (This calculation can take up to 10 minutes.)
Sometimes, though, the UI stops updating. I know the calculation is still running because it completes eventually.
I am guessing Excel is getting too many updates to its screen (i.e. that cell) to keep up with the calculation going on in another thread, so it just gives up on the updating.
Is there a way to force Excel to keep updating the screen? I'm willing to give up the 0.01% slowdown in exchange for continuing to see progress. I see no need for the VB calculation thread to hog out the screen updater.
Excel 2010 on Win XP Pro SP3
View 9 Replies
View Related
Jul 19, 2014
I have a text file with rows and columns of numbers ranging from 1-4 digits that I'd like to import/copy into Excel with each number being in its own cell. But whenever I copy/try to import, Excel splits all of the 3-4 digit numbers up into single digit numbers. The text file has 10,000+ columns (each number occupies two columns so I have half of that amount in numbers) and 300+ lines.
Is the file simply too large for Excel to handle or is there a way I can do this?
View 14 Replies
View Related
Oct 31, 2013
First, I have to say that I am very weak in VBA.
I have a section of code where I need to count the cells from J through BF in rows 42 through 76. The code snippet I'm working on is:
Code:
For r = 42 To 76 Step 1
if Application.WorksheetFunction.Count(Range("J" & r:"BP" & r)) = 0 Then
Err = Err + 1
[Code]....
The code checker highlights the ':' in the 'Range .... = 0' with the message "Expected: list separator or )".
View 2 Replies
View Related
Jan 29, 2014
The code below works fine on smaller data sets. I tried it on a data set of over 165000 records and it gives me the error:
"Runtime Error '6': Overflow"
Clicking debug highlights this line:
rowCount = .DataBodyRange.rows.Count
Code:
Sub Fixtable()
Dim lo As Excel.ListObject
Dim loRow As Excel.ListRow
[Code]....
View 4 Replies
View Related
Feb 9, 2014
How do I enter a formula in excel 2010 that will give the total amount of times each number is in this group. Example : how many times (total) the number 12 showed up , how many times the number 27 showed, and so on for each number that is in the entire group of numbers, from 1 to 80 .
Here is the page I will copy and paste into a workbook sheet from the internet that i want to evaluate the times each number was called.
Very new to all this , I am a bit aged and need not to learn excel A to Z, just need to know what correct statements /formulas have to be entered to do what i desire.
I am only interested in the total count of the small bold numbers 1 to 80, each single digit 1 to 9 and double digits 10 to 80 will be in their separate cells. The large bold three digit numbers and dates/times will have to be erased (manually) before the calculation takes place.
298
2/9/2014 12:28:02 PM
37
77
[Code]....
View 6 Replies
View Related
Jan 12, 2007
I have set up a form where the user can enter the number of copies they want for 10 items (I will call them item1, item2 etc for ease)
Is it possible to then link the numbers in the form to separate parts of a large printing Macro?
View 9 Replies
View Related
May 24, 2013
I have an issue with the excel freeze in our organisation.
Our organisation works on Citrix and the office applications have been upgraded to 2010 very recently.We have both 2003 excel users and 2010 excel users.There is a user who has a problem working on excel 2010 the excel freezes.Excel 2010 works fine for some time and all at a sudden hangs,once its hung it freezes all the other applications.
The same file runs properly on the other 2010 systems.The Excel file which hangs are also not of huge in size.
I am unable to get to the rootcause of the issue why the excel freezes or hangs in the middle of the work getting to the root cause of the issue and an answer for the excel hanging.
View 3 Replies
View Related
Nov 3, 2012
Background: The user makes a selection from a drop down box on the main sheet (sheet5, G12). The drop-down box is linked to *Sheet31.Pax_Nav*. If the drop-down box's linked cell value is less than 5, then do nothing (manual input required). If it is greater than 5, then the vlookup matches that number to a person in the database and returns their weight. The code will pull the required person's weight but then Excel will hang and freeze.
Private Sub Worksheet_Calculate()
On Error Resume Next
If Sheet31.Range("Pax_Nav") > 5 Then
Sheet5.Range("G12").Value = Application.WorksheetFunction.VLookup(Sheet31.Range("Pax_Nav").Value, Sheet31.Range("H17:L48"), 5, False)
Else
End If
End Sub
View 9 Replies
View Related
Jun 26, 2013
I have a file that has been produced using Statistica software. The file is supposed to have around one million rows, and when exported to Excel the file is about 30 MB. When I open the .xlsx file in Excel 2010 only two pages of data appear. The rows also have weird numbering. The first square of the A column is A1. The second is A3833, the third is A6789, then A8161, then A8162, then A8163, then A8164, then A18070.
The scroll button to the left of the screen is long, as if the document was only two pages long. When the scroll button is click-and-dragged a small beige square appears with a row number. This small square seems to be aware that not all rows are shown as it shows many more rows than are visible to me.
View 3 Replies
View Related
Feb 14, 2014
I am using Excel 2010.
My objective is to pull specific values from an external file corresponding to the correct name and year of my choosing. The first way I thought would be best is to use an INDEX/MATCH function. The problem is the external files change names so I would need a method to easily change the source file name from one cell. I then stumbled across the INDIRECT function, but the INDIRECT function will only work when the source file is also opened. I then came across Harlan Grove's pull function which allows you to import data from closed excel files.
So, this is what my formula looks like: =INDEX(pull("'"&G12&"");MATCH(C15;pull("'"&G14&"");0);MATCH(D15;pull("'"&G16&"");0))
Cells G12,G14, and G16 contain the file paths for the ranges. C15 is name and D15 is year.
The problem I have though is that when I try to execute the function, Excel gets stuck. if the code cannot handle large amounts of data. I tested the code with a simple SUM function for a small range from an external file and it worked just fine.
This is the code I am using:
[Code] ...
View 3 Replies
View Related
Jan 30, 2013
code to import a tab delimited text file with about 3 million rows so that it creates a new tab every time it hits the 1 million row limit?
View 3 Replies
View Related
Jun 2, 2014
Below is a formula that I am attempting to modify:
From this:
=IFERROR(IF(A8<MIN(A$8:A$30)+365*5+1,(IF(AND(A8>=$E$4,A8<=$E$5),1,0)*B8*(MAX(C8,D8)/365)+B8),(IF(AND(A8>=$E$4,A8<=$E$5),1,0)*B8*(D8/365)+B8)),"")
To this:
=IFERROR(IF(A8<MIN(A$8:A$30)+365*5+1,B8*(MAX(C8,D8)/365)+B8),B8*(D8/365)+B8)),"")
But it is giving me an error result.
View 2 Replies
View Related
Oct 20, 2009
I have a SS that has 20,000 rows. One of the columns contains numbers. I'm tryiny to filter out the numbers that are NOT 7 digits long. The problem i have is that some of the cells have space in between the numbers. e.g 240 1332, 432 2443, 234 2345 234 etc. And some are normal e.g 4234535, 53596835, 3459284, 2423 etc. So, filtering between ranges isn't working i think because numbers with spaces in them aren't read as numbers in excel.
View 4 Replies
View Related
May 8, 2014
I've got some data which will look something like the following:
987249879238Steven1987dob98023498092384029834Tom1972dob298374928374928374987
I'm looking to remove any set of numbers more than 10 characters long. i.e. the desired output from the above would be:
Steven1987dobTom1972dob
View 4 Replies
View Related
Feb 8, 2013
I have the below code which converts a range to PDF and saves it on our network drive. I would like to change my code to a loop so I don't have to do so much typing. There are 68 rows between each range.
VB:
Sheets("CPS CSR Dashboards").Range("A2:K69").ExportAsFixedFormat xlTypePDF, "G:Call Center ReportingWeeklyAgent DashboardsTemp" & [ 'CPS CSR Dashboards'!M3] & ".pdf"
Sheets("CPS CSR Dashboards").Range("A70:K137").ExportAsFixedFormat xlTypePDF, "G:Call Center ReportingWeeklyAgent DashboardsTemp" & [ 'CPS CSR Dashboards'!M71] & ".pdf"
A2:K69 is the range for Agent 1 which will be saved as as a PDF M3 is the cell which contains Agent 1's name for which the file is to be named.
A70:K137 is the range for Agent 2 which will be saved as another PDF M71 is the cell which contains Agent 2's name.
View 1 Replies
View Related
Jul 6, 2008
I'm working out of the book, and I'm close to what I need but at a beginner's block. I want to delete all rows of a table of stock information where the symbol (column b) contains a "."
Here's what I've got:
Sub Earnings_SymbsClnUp()
'Deletes the newly posted trades that have a "." in the symbol.
Dim finalrow As Integer
Dim i As Integer
finalrow = Cells(Rows.Count, 1).End(xlUp).row - 8
MsgBox finalrow
For i = finalrow To 9 Step -1
If Cells(i, 2).Value = "ITRA" Then
Cells(1, 2).EntireRow.delete
End If
Next i
End Sub
View 9 Replies
View Related
Dec 17, 2012
I have 3 columns of data: col. A = name (random order), col. B = Net #, Col. C = Gross #.
I am using =LARGE(C$1:C$4466,ROWS($D$1:D1) to Automatically sort col C in decending order.
I would Like to do another decending sort but only the values in Col C that corespond to a particular name in Col A. Can I imbed a index match function combination within the large function to do this?
Name
Net
Gross
All Sort
SortA
SortB
SortC
SortD
A
508
-200.129
101.685
[Code] ..........
View 6 Replies
View Related
Nov 21, 2006
Im importing figures into column G of my worksheet, and I need a code so it automatically adds a "0" to the start of each row in column G plus format it.
For example, im pasting in 970702090341 but its showing as 9.70702E+11.
Once I format the cell to 'number' and 0 decimal places it looks fine, but want to save the hassle of doing it each time. Plus I need a zero at the start.
Is there a code possible for this?
View 9 Replies
View Related
Jan 13, 2003
I am putting together a macro to import a CSV file onto excel. I will be manipulating columns of data (concatinating some, dividing by 100 etc.)
What I am having trouble with is that each file imported will have different number of rows.
I tried, in recording a macro, to use autofill (entered formula and double-click fill handle to drop the fourmula into each cell) hoping this would show me how to do it but alas, it just coded the range as the starting and stopping cells (didn't show a count formula or some such.
View 9 Replies
View Related
Nov 16, 2009
I have a spreadsheet with a column of Longitude values like:
A
172828.383E
I want to somehow split the cell into new individual cells so it will be like this:
A B C
17 28 28.383
View 5 Replies
View Related
May 27, 2014
I'm using Excel 2010 and my spreadsheet contains numbers in columns A:E and approx 500+ rows. Here is a 10 row example of my data:
A B C D E
0 1 2 3 4
5 6 7 8 9
0 2 4 6 8
1 3 5 7 9
1 2 4 5 8
3 4 5 6 9
9 8 1 2 3
7 6 1 4 0
0 8 2 1 9
1 0 5 3 2
I would like to count the number of consecutive times each number appears (to a max of 9 consecutive times in a row). So, from my example above:
Number 1 appears:
1 consecutive time = 1 (appears in row 1)
2 consecutive times = 1 (appears in rows 4 & 5)
3 consecutive times = 0
4 consecutive times = 1 (appears in rows 7, 8, 9 & 10)
Number 2 appears:
1 consecutive time = 4 (appears in row 1, row 3, row 5 & row 7)
2 consecutive times = 1 (appears in rows 9 & 10)
3 consecutive times = 0
4 consecutive times = 0
Number 5 appears:
1 consecutive time = 2 (appears in row 2 & row 10)
2 consecutive times = 0
3 consecutive times = 1 (appears in rows 4, 5 & 6)
4 consecutive times = 0
and so on....
View 9 Replies
View Related
Apr 8, 2014
I have a normally easy task that is causing me some grief. In column f of my data I either have a number or this "____________". My goal is to delete the entire row if that line is present but my code is not finding that value in my range.
I am wondering is this some format value or something, but it shows up in the formula line as a line. Doesn't appear to be an underline, but I could be wrong. Below is my code.
[Code] ........
View 9 Replies
View Related
Jun 1, 2012
vb code that will break out each 6 digit media used in their own rows such as in the illustration below.
Sample data before macro
Master Backup
GTI - Hostname
[Code]....
View 2 Replies
View Related
Apr 4, 2014
I wanted to do a multiple return vlookup so I used an Index formula. I have account names and am trying to vlookup contacts associated with those accounts (4 max). So I have a list of Accounts all with 3 blank rows in between them.
How do I loop an array formula? So far I have the code..
[Code] .....
This finds the 4 contacts associated with the first account in C5 which I named the cell "myVar". I now want it to find the contacts associated with the accounts in C9, C13, C17 and so on until the first empty cell.
View 8 Replies
View Related
Feb 4, 2014
I have a database that needs breaking down in order to fulfill a request.
I've been trying to create a macro to copy one row to a new workbook (starting from row 3), file name save as a value of the cell (C1), and move onto the next row. However, my code appears to only loop through 26 entries and then stops.
Code:
Dim row As Long
Dim refname
row = 3
Do While Cells(row).Value ""
[Code] .....
View 3 Replies
View Related
Oct 2, 2012
I want to create a loop that goes down all the rows in my spreadsheet and does the formula (end/beginning -1) for all the rows of cells. The "end" cell is the cell that is the farthest right in the row (some sort of end.xlright) and the "beginning" cell is column D of the row that is being calculated.
View 4 Replies
View Related
Dec 10, 2012
I am trying to extract values from a text. I used macro to solve the problem. I was able to extract the numbers however i am trying not to extract all of the numbers in text. For example as you can see below, i am trying to get only 22.99 The only unique thing here can be $ sign i believe. I need to put a criteria that selects the number right after $ sign and extracts 5-6 decimals after that.
**work lamp/desk light led;orion8879 final price: $22.99 (store)**
this is the text in a cell and i only need 22.99 not 8879)
View 9 Replies
View Related
Apr 30, 2014
I have an excel workbook right now with a 75x75 correlation matrix. It has 75 stock prices and uses bloomberg to pull in the correlation between each of the holdings. There is a lot of data so it takes roughly 35 seconds for it all to get pulled in from bloomberg. The input value that I can change is the date. The output value is a specific correlation coefficient. Thus, if I input today's date into a cell in the file, it will run the correlation matrix and tell me the correlation between all the holdings using the past year's data. Then it will produce a single output value.
I am now looking to use VBA to make this more robust. What I have been trying to do is have a macro which will -
(1) input the current date into the input cell
(2) have the code wait 35 seconds (and since it is using bloomberg pull in the traditional wait methods do not work because they actually stop the data pull in also)
(3) copy the output value
(4) paste special that value in a different cell
(5) repeat the process but this time use the date from a day before and have the output value copied and pasted to a cell below the previous one.
This loop would continue over 20 times.
Below I have some code that allows me to do this process once but is not looped and I have been stuck trying to make this work with a loop given the bloomberg delay. When I add a loop, it does not wait the 35 seconds I need before doing the whole process again.
[Code] .....
View 2 Replies
View Related