View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
tbmarlie tbmarlie is offline
external usenet poster
 
Posts: 26
Default Error when changing the sign on numbers

I'm have the following code which is being run as part of a macro.
I'm trying to change the sign on all of the values in this column so
if its a negative, I want it to be positive and vice versa. When I
run my macro, it gives me a "Run-time error '13': Type Mismatch"
message and when I debug, it highlights the 2nd line below in my
code. Whats confusing to me, though, is that it appears to make all
of the changes (that I intended) to all of the cells in my data down
to my very last row. The cells in this column are formated as type
number. There are null cells in the data which get changed to 0.00,
if that means anything. Thanks.

For k = Cells(Rows.Count, "j").End(xlUp).Row To 1 Step -1
Cells(k, "j").Value = Cells(k, "j").Value * -1
Next k