ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Training on macros in Excel97 using Windows 98 (https://www.excelbanter.com/excel-worksheet-functions/16065-training-macros-excel97-using-windows-98-a.html)

BT Bill

Training on macros in Excel97 using Windows 98
 

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 ?

Andy Brown

"BT Bill" wrote in message
...

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




All times are GMT +1. The time now is 05:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com