View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Colin Hayes Colin Hayes is offline
external usenet poster
 
Posts: 465
Default Making code less column-specific

In article , Don Guillett
writes
Show your layout or send a sample workbook to my address below with a clear
explanation and before/after examples.

Don ,

Here's an example :

Before

A B C D

1 132 56 12
2 133 56 13
3 134 56 14
4 135 56 15
5 136 56 16
6 137 56 17
7 138 56 18
8 139 56 19
9 140 56 20
10 141 56 21
11 142 56 22
12 143 56 23
13 144 56 24
14 145 56 25
15 146 56 26



* I need to be able to highlight any complete column , and run the
macro.

* The Popup will ask me what number to add or subtract from the cells in
the column I've chosen.

*EG I highlight column B , and run the macro. I enter a figure of -5 and
click OK. Each number in column B is reduced by 5.


* The changes overwrite the original cells , down to the last one in the
column.

* The macro would work on the selected column , whichever it is.

* There is a header cell , so it would operate from Row 2 down.



After

A B C D

1 127 56 12
2 128 56 13
3 129 56 14
4 130 56 15
5 131 56 16
6 132 56 17
7 133 56 18
8 134 56 19
9 135 56 20
10 136 56 21
11 137 56 22
12 138 56 23
13 139 56 24
14 140 56 25
15 141 56 26


* Hope that's a bit clearer now. Outcome shown above.



Best Wishes


Colin