Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I'm testing an idea I had. In cells B1, 2, and 3 I have the numbers 1, 2, and
3, respectively. I wrote a macro hoping to put the value 4 in cell C1. However, this macro is intended to add 1 to the preceding value, so, for example, if cell B52 has the value 52 in it, the macro will put the value 53 in cell C1. Here's my code: Sub test() Dim x As Integer Range("B1").Select Selection.End(xlDown).Select Selection.Value = x x = x + 1 Range("C1").Select Selection.Value = x End Sub My problem is that the last value (in my test it was 3, in cell B3) was changed to zero, so the value of 1 was put in C1. What am I doing wrong? comparini3000 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
What am I doing wrong? | Excel Discussion (Misc queries) | |||
Wrong Numerical Input | Excel Discussion (Misc queries) | |||
SUMPRODUCT is showing wrong Amount | Excel Discussion (Misc queries) | |||
hyperlink navigation path path wrong in Excel 2003 | Excel Discussion (Misc queries) | |||
Logic statement returns wrong answer. | Excel Worksheet Functions |