| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 10912 | 2001-08-20 22:55:00 | Excel function | Guest (0) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 17316 | 2001-08-20 22:55:00 | My sheet consists of positive numbers in rows and columns which I want to show as negative numbers. I want to multiply the whole selection of the rows and columns with -1. i know there is a way of doing this but cant remember . Can someone please tell me how this can be done. Thanks |
Guest (0) | ||
| 17317 | 2001-08-21 04:58:00 | The following macro will perform this task. Adjust the starting and finishing numbers for the columns and rows to exclude any non-numerical headers etc. It will ignore zeros, blank cells and already negative numbers, but will choke on string values. It may take a while depending on the number of total cells involved. Sub pos_to_neg() For rwIndex = 1 To 20 For colIndex = 1 To 10 With ActiveSheet.Cells(rwIndex, colIndex) If .Value > 0 Then .Value = .Value * -1 If .Value = '' Then .Value = '' If .Value < 0 Then .Value = .Value End With Next colIndex Next rwIndex End Sub HTH |
Guest (0) | ||
| 17318 | 2001-08-22 07:37:00 | I had this problem,and not used to macros did the following. Say your array of numbers is from a1:c6. In d1 enter =if(a1,a1*-1,''), copy this down to a6 and across to c6. You will now have an array of negative numbers. You can now Hide original array. Try It! |
Guest (0) | ||
| 17319 | 2001-08-23 07:41:00 | Hi Raj, I have again been thinking about your problem. There is another way - select the area ( say a1: f10 )where the entered values are to show negative even if entered as +value. Select FORMAT/CELL. Select the NUMBER tab. In the type box enter -0.00 and select OK. Whenever a value is entered into a cell it will record negative. |
Guest (0) | ||
| 1 | |||||