Excel 2010:
I have not used VBA much in Excel, but a lot in Access.
Is it possible to write a function like:
Function AddTwoCells( lA as Long, lB as Long) as Long
AddTwoCells = lA + lB
End Function
Then call the function by entering =AddTWoCells(A2, B2) into cell C2, for example.
I have a complicated string concantenation to perform over a couple of hundred rows. The =IF() function would work, but would be way to cumbersome and hard to maintain.
Looking at my book and at the internet, all I find is code which is run by the 'Run' command.
The idea would be to paste the function/formula into the 200 cells, then special copy the resulting values manually into a different file.
When I try this, I just get the #NAME error in the cell - it's not seeing the function even though I've declared it as public.
Thanks
Mike Thomas
I have not used VBA much in Excel, but a lot in Access.
Is it possible to write a function like:
Function AddTwoCells( lA as Long, lB as Long) as Long
AddTwoCells = lA + lB
End Function
Then call the function by entering =AddTWoCells(A2, B2) into cell C2, for example.
I have a complicated string concantenation to perform over a couple of hundred rows. The =IF() function would work, but would be way to cumbersome and hard to maintain.
Looking at my book and at the internet, all I find is code which is run by the 'Run' command.
The idea would be to paste the function/formula into the 200 cells, then special copy the resulting values manually into a different file.
When I try this, I just get the #NAME error in the cell - it's not seeing the function even though I've declared it as public.
Thanks
Mike Thomas