Jump to content

Excel Scripts


 Share

Recommended Posts

I have an excel spreadsheet with the following equation in one column, =sum(g:42)*2 where the second number will range from 1 to 24. I would like to be able to write a script that would decrease the second number by 1 in each cell in the column where that number exists. Is this something that AutoIt can do?

Link to comment
Share on other sites

I think if you put the second number in another cell like this:

=sum(g:42)*h42

then use Autoit to edit h42 by sending keystrokes that should work

look at "Send" in your help files, it also helps if you know what the keystrokes in Excel are.

Link to comment
Share on other sites

Surely this sorta thing would be better through a formula in Excel, or maybe even just a fill down, rather than AutoIt-ing it.

I agree.

Although I'm not sure that Excel Forumlas themselves are versitile enough to do what mrrlg's asking. However I believe that most versions of Excel should be equipped with a VBA Macro editor, and this should be easy to do within a macro.

Link to comment
Share on other sites

It's been ages since I last used excel, but I doubt whether the expression:

=sum(g:42)*h42

is any different from

g42*h42

The reason is that the expression sum is used to add arrays rather than single cells, I might be wrong though.

An interesting alternative solution is to create an intermediate column to do the firts part of your operation and a second column to decrease the value by 1. you may then hide the intermediate column by grouping it. Both can be done manually or automated with autoit. I believe I've done something similar ages ago.

IVAN

Edited by ivan
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...