Training on macros in Excel97 using Windows 98

G

Guest

British Telecom use hhhh:mm:ss time format in downloaded bills, which
Excel97 does not recognise. Cannot re-format to hh:mm:ss - Excel does not
recognise hhhh:mm:ss as a numeric format ??. Tried (with no experience) to
create a macro but having set it up to remove first two h's from first ten
entries (of 546) when I applied the macro to entry eleven, it simply
replicated the values of the first ten.

Can anybody tell me what to do or where I can find out more about macros
than is in Excel97's "Help" section ?
 
A

Andy Brown

when I applied the macro to entry eleven, it simply
replicated the values of the first ten.

This happens when your code uses absolute references rather than relative
references. If you have:

Range("A1") = 1

, you get 1 in A1. But

ActiveCell = 1

gives you one in the cell that's selected when you start the code.

If you used the macro recorder, try again. When the "Stop Recording"
toolbar's visible, notice that it has a "Relative Reference" button. When
you click this, everything you do from then on is recorded in relative (to
the active cell) mode -- until you click it again (it toggles on & off).

Post your code here if you wish ; ultimately, you'll need something *like*:

For Each Cell In Selection
Cell.Value = Right(Cell, (Len(Cell) - 2))
Next Cell

Rgds,
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top