 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
http://www.gamasutra.com/view/feature/3563/microsoft_excel_revolutionary_3d_.php
While this may be pushing it a bit far, Excel is actually useful for doing a
lot more than most people realise...
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
scott wrote:
> While this may be pushing it a bit far, Excel is actually useful for
> doing a lot more than most people realise...
Excel is a first-order functional programming language with a
sophisticated UI. ;-)
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Orchid XP v7 wrote:
> Excel is a first-order functional programming language with a
> sophisticated UI. ;-)
Now, just imagine if Excel would use Haskell instead of VB - you could
use the same language for the cell formulas and the macros! :-D
Hmm, pitty it'll never happen...
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Invisible" <voi### [at] dev null> a écrit dans le message de news:
47d4ff20@news.povray.org...
> Hmm, pitty it'll never happen...
Now here's a new challenge for you:
http://neilmitchell.blogspot.com/2007/03/hsexcel.html
G.
--
*****************************
http://www.oyonale.com
*****************************
- Graphic experiments
- POV-Ray, Cinema 4D and Poser computer images
- Posters
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Gilles Tran wrote:
> "Invisible" <voi### [at] dev null> a écrit dans le message de news:
> 47d4ff20@news.povray.org...
>> Hmm, pitty it'll never happen...
>
> Now here's a new challenge for you:
> http://neilmitchell.blogspot.com/2007/03/hsexcel.html
Heh. I know almost nothing about VBA, so...
I've also often wished that GNU Plot used Haskell as it's function
definition language - that would be so much more flexible! (Although the
static typing might get tedious...)
I think perhaps the big problem is that Haskell (unlike many "scripting
languages") lacks a nice simple interpretter that's easy to call from
anywhere.
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
>
> Now, just imagine if Excel would use Haskell instead of VB - you could
> use the same language for the cell formulas and the macros! :-D
>
Actually I'd say you can do that with VBA too. Just create a function
that passes the input to VBA translator.
--
Eero "Aero" Ahonen
http://www.zbxt.net
aer### [at] removethis zbxt net invalid
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> Now, just imagine if Excel would use Haskell instead of VB - you could
>> use the same language for the cell formulas and the macros! :-D
>>
>
> Actually I'd say you can do that with VBA too. Just create a function
> that passes the input to VBA translator.
Right. And what non-trivial operations can you perform with a snippet of
VBA small enough to resonably fit into a single cell?
Yeah, exactly.
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
>
> Right. And what non-trivial operations can you perform with a snippet of
> VBA small enough to resonably fit into a single cell?
Depends on A) what you're doing and B) what functions for VBA you have
pre-made. Would the 1024 (oslt) char limit on Excel cell would be
seriously more usable with plain Haskell?
> Yeah, exactly.
--
Eero "Aero" Ahonen
http://www.zbxt.net
aer### [at] removethis zbxt net invalid
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> Right. And what non-trivial operations can you perform with a snippet
>> of VBA small enough to resonably fit into a single cell?
>
> Depends on A) what you're doing and B) what functions for VBA you have
> pre-made. Would the 1024 (oslt) char limit on Excel cell would be
> seriously more usable with plain Haskell?
Well let's put it this way. If you wanted to calculate the geometric
mean (assuming there isn't already a function for that), in VBA you'd
have to write an explicit FOR loop (with initialisation, update, etc.),
whereas in Haskell you'd just keep a "map" call... It's a 1-liner.
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
>>
>> Depends on A) what you're doing and B) what functions for VBA you have
>> pre-made. Would the 1024 (oslt) char limit on Excel cell would be
>> seriously more usable with plain Haskell?
>
> Well let's put it this way. If you wanted to calculate the geometric
> mean (assuming there isn't already a function for that), in VBA you'd
> have to write an explicit FOR loop (with initialisation, update, etc.),
> whereas in Haskell you'd just keep a "map" call... It's a 1-liner.
>
Meaning that you have pre-done function/call for it in Haskell (no, it
doesn't have to be self-made, it just is implemented earlier, usually
since someone has needed it).
--
Eero "Aero" Ahonen
http://www.zbxt.net
aer### [at] removethis zbxt net invalid
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> Well let's put it this way. If you wanted to calculate the geometric
>> mean (assuming there isn't already a function for that), in VBA you'd
>> have to write an explicit FOR loop (with initialisation, update,
>> etc.), whereas in Haskell you'd just keep a "map" call... It's a 1-liner.
>>
>
> Meaning that you have pre-done function/call for it in Haskell (no, it
> doesn't have to be self-made, it just is implemented earlier, usually
> since someone has needed it).
The point being that it is *possible* to define the "map" function in
Haskell, whereas such a function cannot be defined in VBA. :-P
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
> in VBA you'd have to write an explicit FOR loop
Not in Excel. What are you smoking? :-)
--
Darren New / San Diego, CA, USA (PST)
"That's pretty. Where's that?"
"It's the Age of Channelwood."
"We should go there on vacation some time."
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Orchid XP v7 wrote:
>
> The point being that it is *possible* to define the "map" function in
> Haskell, whereas such a function cannot be defined in VBA. :-P
>
Umm.. I'm not getting this - why is it impossible to define in VBA?
--
Eero "Aero" Ahonen
http://www.zbxt.net
aer### [at] removethis zbxt net invalid
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> The point being that it is *possible* to define the "map" function in
>> Haskell, whereas such a function cannot be defined in VBA. :-P
>>
>
> Umm.. I'm not getting this - why is it impossible to define in VBA?
Because in VBA, you can't pass functions as arguments to functions.
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Orchid XP v7 wrote:
>>> The point being that it is *possible* to define the "map" function in
>>> Haskell, whereas such a function cannot be defined in VBA. :-P
>>>
>>
>> Umm.. I'm not getting this - why is it impossible to define in VBA?
>
> Because in VBA, you can't pass functions as arguments to functions.
Oh, right. I bet there's *some* way to get the equivalent of function
pointers, but I don't know VBA well enough offhand...
Actually, you can. It just takes more work. You have to do it the way
you'd do in (say) java, and make a com object with the functionaltiy you
need. Perhaps overkill, yes.
--
Darren New / San Diego, CA, USA (PST)
"That's pretty. Where's that?"
"It's the Age of Channelwood."
"We should go there on vacation some time."
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"scott" <sco### [at] laptop com> wrote:
> http://www.gamasutra.com/view/feature/3563/microsoft_excel_revolutionary_3d_.php
>
> While this may be pushing it a bit far, Excel is actually useful for doing a
> lot more than most people realise...
My goodness, the robot is cool, but how did they get all those moving blue
lights in the background?!
(jk-- for a sec I thought the Intel ad on that web page *was* the image.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Orchid XP v7 wrote:
>
> Because in VBA, you can't pass functions as arguments to functions.
>
I wouldn't be so sure, especially after reading Darren post. PITA for
sure and the kind of work no sane person would do, but I wouldn't say
impossible.
I might check at work some day, if I'll remember and if I'll have time.
--
Eero "Aero" Ahonen
http://www.zbxt.net
aer### [at] removethis zbxt net invalid
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> in VBA you'd have to write an explicit FOR loop
>
> Not in Excel. What are you smoking? :-)
Really? Care to explain that one?
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>>> in VBA you'd have to write an explicit FOR loop
>>
>> Not in Excel. What are you smoking? :-)
>
> Really? Care to explain that one?
Off the top of my head:
=product(range)^(1/count(range))
...unless there is some geometric mean function, I didn't search for one.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
And lo on Wed, 12 Mar 2008 10:47:34 -0000, scott <sco### [at] laptop com> did
spake, saying:
>>>> in VBA you'd have to write an explicit FOR loop
>>> Not in Excel. What are you smoking? :-)
>> Really? Care to explain that one?
>
> Off the top of my head:
>
> =product(range)^(1/count(range))
>
> ...unless there is some geometric mean function, I didn't search for o
ne.
=geomean(range) which does exactly the same as your function.
--
Phil Cook
--
I once tried to be apathetic, but I just couldn't be bothered
http://flipc.blogspot.com
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>>>> in VBA you'd have to write an explicit FOR loop
>>>
>>> Not in Excel. What are you smoking? :-)
>>
>> Really? Care to explain that one?
>
> Off the top of my head:
>
> =product(range)^(1/count(range))
>
> ...unless there is some geometric mean function, I didn't search for one.
Ah. In other words, "you don't need to code this because it's already
pre-defined".
Or, to put it another way, I picked a bad example. ;-)
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> Ah. In other words, "you don't need to code this because it's already
> pre-defined".
>
> Or, to put it another way, I picked a bad example. ;-)
Or, a lot of what you might want to do in a spreadsheet is pre-defined :-)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> Or, to put it another way, I picked a bad example. ;-)
>
> Or, a lot of what you might want to do in a spreadsheet is pre-defined :-)
Or, I use a spreadsheet in a way that's very different to how normal
people use them.
(E.g., Excel doesn't provide a "convolution" function. And it would be
far too hard to implement one in VBA. Not because the algorithm is hard,
but because I'd have to figure out how to access the cells of the
spreadsheet...)
I tend to use Excel as a function plotter - and it's annoying that
things like an FFT are so hard to do.
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Invisible" <voi### [at] dev null> a écrit dans le message de news:
47d7d30f$1@news.povray.org...
> I tend to use Excel as a function plotter - and it's annoying that things
> like an FFT are so hard to do.
The built-in FFT in Excel doesn't work?
In any case, accessing cells with VBA is basic. Just start recording a macro
and put something in a cell to see how it's done.
G.
--
*****************************
http://www.oyonale.com
*****************************
- Graphic experiments
- POV-Ray, Cinema 4D and Poser computer images
- Posters
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> Not because the algorithm is hard,
> but because I'd have to figure out how to access the cells of the
> spreadsheet...)
Oh my God.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
scott wrote:
>> Not because the algorithm is hard, but because I'd have to figure out
>> how to access the cells of the spreadsheet...)
>
> Oh my God.
I know...
What can I say? VB isn't exactly the easiest programming language ever.
And this stuff isn't really documented anywhere. (Sure, there's an
online help system that will tell you what function X does. But if you
don't know the name of the function you need... that's not much help.)
Now you see why it took me several hours to write a VB macro that puts
today's date into a particular cell?
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> I tend to use Excel as a function plotter - and it's annoying that things
>> like an FFT are so hard to do.
>
> The built-in FFT in Excel doesn't work?
Excell has an FFT? Since when? (Or is it in one of the non-default add-ins?)
> In any case, accessing cells with VBA is basic. Just start recording a macro
> and put something in a cell to see how it's done.
I didn't realise that uses VB. Oh, wait, I'm thinking about Access...
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> And this stuff isn't really documented anywhere.
Rubbish!
Try looking up "range" or "cells" or "worksheet" in the object browser and
reading the help. It even gives examples, like (these are from the help on
the "range" keyword, the others are similar):
Worksheets("Sheet1").Range("A5").Value =
Worksheets("Sheet1").Range("A1").Value
Worksheets("Sheet1").Activate
Range("A1:H8").Formula = "=Rand()" 'Range is on the active sheet
Worksheets(1).Cells(1, 1).Value = 24
ActiveSheet.Cells(2, 1).Formula = "=Sum(B1:B5)"
How could it be any more clear what to do? Or, as Gilles said, record a
macro and then look at the code (and the help related to the code
generated) - a nice trick for learning how to do lots of things in Excel
(like creating charts, changing borders, sorting etc).
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Invisible" <voi### [at] dev null> a écrit dans le message de news:
47d7e009$1@news.povray.org...
>>> I tend to use Excel as a function plotter - and it's annoying that
>>> things like an FFT are so hard to do.
>>
>> The built-in FFT in Excel doesn't work?
>
> Excell has an FFT? Since when? (Or is it in one of the non-default
> add-ins?)
It's in the Analysis Toolpak which is not turned on by default (but just a
checkbox away).
http://www.maxim-ic.com/appnotes.cfm/an_pk/3292
It's been there for years I believe (the Analysis Toolpak has been there
since Excel 95 at least, I'm not sure about FFT itself).
> I didn't realise that uses VB. Oh, wait, I'm thinking about Access...
I don't understand what you're saying... The entire Office suite uses VBA.
Actually that's one big selling point of Office (for businesses): one can
automate all the Office applications using the same language and have them
interact with each other.
G.
--
*****************************
http://www.oyonale.com
*****************************
- Graphic experiments
- POV-Ray, Cinema 4D and Poser computer images
- Posters
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> Excell has an FFT? Since when? (Or is it in one of the non-default
>> add-ins?)
>
> It's in the Analysis Toolpak which is not turned on by default (but just a
> checkbox away).
Ah, right. I don't think I have that installed... (But as you say,
that's not hard to fix.)
I hope it's less clunky than that hacked-in complex number "support"
Excell has though.
>> I didn't realise that uses VB. Oh, wait, I'm thinking about Access...
>
> I don't understand what you're saying... The entire Office suite uses VBA.
Yes. But Access has an additional "macro language" that only Access
uses. By default it seems to record macros with that.
> Actually that's one big selling point of Office (for businesses): one can
> automate all the Office applications using the same language and have them
> interact with each other.
Heh. I'm *so* not trying that... ;-)
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
scott wrote:
>> And this stuff isn't really documented anywhere.
>
> Rubbish!
>
> Try looking up "range" or "cells" or "worksheet" in the object browser
> and reading the help.
What is the "object browser"?
> Worksheets(1).Cells(1, 1).Value = 24
>
> ActiveSheet.Cells(2, 1).Formula = "=Sum(B1:B5)"
>
> How could it be any more clear what to do?
That seems reasonably clear.
Now, if you call a macro with a cell range as its argument, how does
that work?
> Or, as Gilles said, record a
> macro and then look at the code (and the help related to the code
> generated) - a nice trick for learning how to do lots of things in Excel
> (like creating charts, changing borders, sorting etc).
I'm still at the level of not really knowing how to work the VB editor,
and not understanding basic VB syntax constructs...
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Invisible" <voi### [at] dev null> a écrit dans le message de news:
47d7eaea$1@news.povray.org...
> Yes. But Access has an additional "macro language" that only Access uses.
> By default it seems to record macros with that.
No, you can't record a macro in Access. Recording macros is an
Excel/Word/Powerpoint thing and it (now) produces VBA code. I agree that
"macro" as a term is inconsistently used in MS Office (a legacy issue I
guess).
G.
--
*****************************
http://www.oyonale.com
*****************************
- Graphic experiments
- POV-Ray, Cinema 4D and Poser computer images
- Posters
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible escribió:
> I'm still at the level of not really knowing how to work the VB editor,
> and not understanding basic VB syntax constructs...
RTFM? It is all explained...
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Nicolas Alvarez wrote:
> RTFM? It is all explained...
Manual? Chance would be a fine thing!
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> What is the "object browser"?
Right click in the code view and choose "Object Browser". It basically
shows every "object" available, and what its members are. Help is available
for every item.
> Now, if you call a macro with a cell range as its argument, how does that
> work?
I don't have any experience with that, but I assume that the range would
just be placed into a variable, just like if you passed a number or
individual cell etc. Look up "range" in the object browser and you'll see
its member functions to work with it.
> I'm still at the level of not really knowing how to work the VB editor,
> and not understanding basic VB syntax constructs...
Get a book? Read a tutorial online? Trial and error?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
scott wrote:
> Get a book?
I think if I ever need to do this for real, that would be the only
viable option...
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Gilles Tran wrote:
>
> I don't understand what you're saying... The entire Office suite uses VBA.
> Actually that's one big selling point of Office (for businesses): one can
> automate all the Office applications using the same language and have them
> interact with each other.
And that's a darn good thing. I've avoided tens or even hundreds of
hours of clicking around spreadsheets with VBA in past 5 years.
What comes for the missing pre-defined functions, I haven't found an
"explode" -function so far, so I did need to code one. It wasn't hard -
macro recorder and surfing the internet told me everything I needed.
> G.
>
--
Eero "Aero" Ahonen
http://www.zbxt.net
aer### [at] removethis zbxt net invalid
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
>>> in VBA you'd have to write an explicit FOR loop
>>
>> Not in Excel. What are you smoking? :-)
>
> Really? Care to explain that one?
Yeah. I don't need a loop to call SUM(A1:A10) either. :-)
--
Darren New / San Diego, CA, USA (PST)
"That's pretty. Where's that?"
"It's the Age of Channelwood."
"We should go there on vacation some time."
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
> And this stuff isn't really documented anywhere.
Are you familiar with msdn.microsoft.com, the complete documentation for
everything you program on Windows that comes from Microsoft?
--
Darren New / San Diego, CA, USA (PST)
"That's pretty. Where's that?"
"It's the Age of Channelwood."
"We should go there on vacation some time."
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> And this stuff isn't really documented anywhere.
>
> Are you familiar with msdn.microsoft.com, the complete documentation for
> everything you program on Windows that comes from Microsoft?
No. I'm aware it documents the really low-level Win32 API stuff that
only C programmers understand. I wasn't aware it contains anything
useful to normal people...
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
And lo on Wed, 12 Mar 2008 14:41:20 -0000, Invisible <voi### [at] dev null> did
spake, saying:
> scott wrote:
>>> And this stuff isn't really documented anywhere.
>> Rubbish!
>> Try looking up "range" or "cells" or "worksheet" in the object brows
er
>> and reading the help.
>
> What is the "object browser"?
>
>> Worksheets(1).Cells(1, 1).Value = 24
>> ActiveSheet.Cells(2, 1).Formula = "=Sum(B1:B5)"
>> How could it be any more clear what to do?
>
> That seems reasonably clear.
or even MyValue = Worksheets("Results").Range("A1:D5").Value
> Now, if you call a macro with a cell range as its argument, how does
> that work?
Not sure what you mean, you can pass arguments on in the normal manner
i.e. Call Macro1(MyRange) from within another macro, or do you mean how
do
I pass what you've selected in the worksheet to the macro you're running
?
Which would be
ActiveWorksheet.ActiveCell or better ActiveWorksheet.Selection
so the date function could be
Sub InsertDate()
On Error Goto Handler
ActiveWorksheet.ActiveCell.Value = Format(Date, "Medium Date")
Exit Sub
Handler: MsgBox ("No cell selected")
End Sub
Depends on what you're exactly trying to do though, if you're trying to
ensure that everytime a sheet is accessed a date/time stamp is appended
to
a list on a sheet then
Sub AddStamp()
NoOfEntries = Worksheets("Date").UsedRange.Rows.Count
Worksheets("Date").Cells(NoOfEntries + 1, 1).Value = Format(Date, "Med
ium
Date")
End Sub
Just stick the word "Date" in A1 on the sheet "Date" then hide the sheet
then run it at startup from ThisWorkbook with
Private Sub Workbook_Open()
Call AddStamp()
End Sub
It also has the advantage that UsedRange counts every cell that *has* be
en
used, so if some sneaky soul just deletes the date (rather then the enti
re
row) it'll be left blank when the next stamp is placed.
>> Or, as Gilles said, record a macro and then look at the code (and the
>> help related to the code generated) - a nice trick for learning how t
o
>> do lots of things in Excel (like creating charts, changing borders,
>> sorting etc).
>
> I'm still at the level of not really knowing how to work the VB editor
,
> and not understanding basic VB syntax constructs...
Recording stuff and picking it apart really helps, just pick the command
and hit F1 for a meaning and example.
--
Phil Cook
--
I once tried to be apathetic, but I just couldn't be bothered
http://flipc.blogspot.com
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> Now, if you call a macro with a cell range as its argument, how does
>> that work?
>
> Not sure what you mean, you can pass arguments on in the normal manner
> i.e. Call Macro1(MyRange) from within another macro, or do you mean how
> do I pass what you've selected in the worksheet to the macro you're
> running? Which would be
>
> ActiveWorksheet.ActiveCell or better ActiveWorksheet.Selection
Actually I meant "how do I make it so I can write =MyMacro(A4:C9) in a
cell formula and have it actually work properly?"
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible escribió:
>>> Now, if you call a macro with a cell range as its argument, how does
>>> that work?
>>
>> Not sure what you mean, you can pass arguments on in the normal manner
>> i.e. Call Macro1(MyRange) from within another macro, or do you mean
>> how do I pass what you've selected in the worksheet to the macro
>> you're running? Which would be
>>
>> ActiveWorksheet.ActiveCell or better ActiveWorksheet.Selection
>
> Actually I meant "how do I make it so I can write =MyMacro(A4:C9) in a
> cell formula and have it actually work properly?"
>
Ah, so you want to convert your macro into a formula function? I would
look at the manual for you... but I uninstalled M$ Office a while ago :)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
And lo on Thu, 13 Mar 2008 12:23:47 -0000, Invisible <voi### [at] dev null> did
spake, saying:
>>> Now, if you call a macro with a cell range as its argument, how does
>>> that work?
>> Not sure what you mean, you can pass arguments on in the normal mann
er
>> i.e. Call Macro1(MyRange) from within another macro, or do you mean h
ow
>> do I pass what you've selected in the worksheet to the macro you're
>> running? Which would be
>> ActiveWorksheet.ActiveCell or better ActiveWorksheet.Selection
>
> Actually I meant "how do I make it so I can write =MyMacro(A4:C9) in
a
> cell formula and have it actually work properly?"
You can't with macros you need to use a function instead so add a module
to your worksheet and try
Public Function Temperature(Degrees As Double, ConvertType)
If ConvertType = "C" Then
Temperature = (Degrees - 32) * (5 / 9)
Else
If ConvertType = "F" Then
Temperature = (Degrees / 5 / 9) + 32
Else
Temperature = CVErr(xlErrNA)
End If
End Function
Now go to your worksheet and enter =Temperature(32, "C") and you'll ge
t a 0
--
Phil Cook
--
I once tried to be apathetic, but I just couldn't be bothered
http://flipc.blogspot.com
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Darren New wrote:
> Yeah. I don't need a loop to call SUM(A1:A10) either. :-)
Right. So I picked a bad example. :-P
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |