Hi!
I have a suggestion that I think will speed up things a little. this is a method using arry calculations instead of excelfunctions like find, vlookup, match or similar.
Copy this sub and run it as a macro on a sheet to see what happens.
Hope it'll be useful, maybe you already now this...
For your information:
I found the error. There must be a space between the & and the variable e.g.
"& myField &" is OK
"&myField&" is WRONG
Amazing I didn't realize before...
Rgds HL
Hi!
Neither do I now....
I spent 5 hours trying to get the syntax to work and all the time I either got the error message:
'Run-time error 1004, Application-defined or Object-defined error'
when I was running my macro, or my code didn't even get get trough the debugger.
Since I'm new at...
In a Sub I have this code:
Application.Goto Reference:="myField" Selection.FormulaR1C1 = "=RC[-3]+RC[-1]"
Note that myField is a column (in a database area, myField is the field name of the column) so the formula is calulated on all cells in the column, and for each cell...
SkipVought:
Hi! Thanks, I wanted to use the cells method but couldn't work out the syntax. Unfortunately I have emtpy rows inside this dataarea, so I'll have to settle with the first tip although the second one would have been great to use!
/HL
Thanks!
Works perfect. I'm new at VBA and being able to use variables in references opens up a lot of possibilities. None of the books that I use mention this syntax. A star from me!
/HL
Hi!
I’m trying to do a macro that define a new database area from cell A1 to the cell at the r:th row and c:th column. How can I use a reference that takes variables as argument? Like for example, Cells(r, c)?
I can select the new area with this code.
range(Cells(10, 1), Cells(r, c)).Select...
Thank you so much, both of you! It worked beautifully when I wrote my function like this:
Function myFun(area1 As Range)
Dim area2 As Variant
‘…mycode…
area2 = area1.Value2
mySub area2
‘…mycode…
End Function
With:
Sub mySub(area3 As Variant)
Dim i, j, k, l As Integer...
Hi!
My main problem is how to convert a Range object into an Array without using any loops?
This is the background:
I need to write a user-defined function in VBA for Excel that takes a Range (2 cols and many rows) in an Excel-sheet as an argument and rearrange the rows so that the values in...
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.