I have an open source VBA sort function here:
http://newtonexcelbach.wordpress.com/2009/03/23/a-sort-function/
The function can be used either from within VBA, or as a UDF to provide a dynamic sort.
There is also a link to a Chip Pearson article on sorting by transfer to the spreadsheet and...
Or to put the values into a variant array, rather than a range object:
With Worksheets("Customers")
rngBags = Range(.Range("B1"), .Range("B1").End(xlDown)).Value2
end with
Doug Jenkins
http://newtonexcelbach.wordpress.com/
Yes, stick to Longs with Excel VBA. Using Integers will just slow things down as they are converted to Longs anyway.
Doug Jenkins
http://newtonexcelbach.wordpress.com/
I didn't read what Chip had to say about it, but when you return an array as a UDF return value it doesn't have to be the same size as the selected range.
If the selected range is smaller then the excess values just won't be displayed (they are still available to the =INDEX function), or if it...
If I understand you correctly, you can assign the array to the function return value, then enter the function as an array function (press ctrl-shift-enter).
Doug Jenkins
http://newtonexcelbach.wordpress.com/
Groves22 - You seem to be doing a lot of work on the spreadsheet using VBA; e.g.
.Range("D7:D10").Value = scrap.Sheets(1).Range("D" & j + 1 & ":D" & j + 4).Value
etc
I'm suggesting you could read the contents of your scap sheet(s) into an array, process that entirely within VBA, then write the...
Rather than working with range objects I'd recommend reading in the data as a variant array, working on that, then writing it back to the spreadsheet:
dim BigBlockofData as variant, BigBlockofData2 as variant
BigBlockofData = Range("name or address").value2
' Do some stuff on BigBlockofData...
A few more comments:
If you enter the number as a decimal (100.0) the VB Editor will change it to 100# for you.
If you step through the routine and click on help when it hits the problem the help gives the reason for the problem, as given earlier in the thread. (I confess to being amazed that...
That checks if aTime is no more than 2 hours less than lastaTime.
You need:
If (CDate(aTime) - TimeValue("02:00:00")) >= CDate(lastaTime)) then
...
Doug Jenkins
http://newtonexcelbach.wordpress.com/
An array of doubles does not have any format information. You can assign the array to a range, and then apply the formatting, or use a range rather than an array in the first place.
Doug Jenkins
http://newtonexcelbach.wordpress.com/
Watersprite - the first thing is if you are using a named range you don't need to qualify it with the Worksheets("sheet5"). Secondly if you have a named range for the output you won't need to hard code the worksheet and location.
But the advantage of using an array is that you can do all the...
The line Cell.value = cell.formula should do what you want:
Sub ConvertEq()
Dim textrange As Range, cell As Range
Set textrange = Range("myrange")
For Each cell In textrange.Cells
cell.Value = cell.Formula
Next cell
End Sub
Doug Jenkins
http://newtonexcelbach.wordpress.com/
I tried the code posted by Skip in XL2007, and it seems to work, with ribbon visible or hidden, using a simple rectangular shape.
I know that the way in which arcs are specified changed in 2007. Could that have anything to do with it?
Doug Jenkins
http://newtonexcelbach.wordpress.com/
You can call a function from another VBA routine, or you can enter it on the spreadsheet in the same way as the built in Excel functions, but if you want to run it from the Macro list, or attach it to a button, you will have to either make it a Sub or write a short Sub that calls the function...
Nodes isn't defined in the code as posted, but you should have got a message saying that when you tried to run it.
What messages do you get?
Doug Jenkins
http://newtonexcelbach.wordpress.com/
How much difference are you getting? There shouldn't be any difference up to the 14th significant figure.
Was "Application.WorksheetFunction.Atan2(HypotA1A2, A3) a typo? It should be Atan2(adjacent, opposite)
If you are using multiple copies of this function you will find a significant...
I also have used and enjoyed John Walkenbach's Excel Power Programming.
For a printed reference I can recommend Excel 2007 VBA - Programmer's Reference by Green, Bullen, Bovey and Alexander. It's definitely not a "get you started" text, but it's the most complete printed documentation that I...
The Excel "Eval" function will do what you want, except it won't recognise user defined functions. You can find a spreadsheet with a UDF using this technique to evaluate integrals here:
http://newtonexcelbach.wordpress.com/2008/07/05/evaluate-function-update/
If you follow the links from that...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.