View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Negative number morphing to a cell code

You are correct.

If you select a cell, say L11, and enter -3 you will see:
-3
in the cell. However you wanted to see:
3+L11
in the cell. This means making the negative number into a positive number
and then appending the cell address to that positive number. That is what
the VBA macro does.
--
Gary''s Student - gsnu200747


"nickra" wrote:

On Sep 27, 12:44 am, Gary''s Student
wrote:
As coded this only works on cell B9. Even though it look complicated, its not:

1. right-click the tab name at the bottom of Excel
2. select View Code
this open a VBA window
3. paste my stuff in
4. close the VBA window

play around with entering positive and negative values in B9.

If you are nervious about VBA, just try it out on a fresh new workbook first.
--
Gary''s Student - gsnu200747

"nickra" wrote:
On Sep 24, 7:28 pm, Gary''s Student
wrote:
Sorry - use this version instead:


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B9")) Is Nothing Then Exit Sub
If Target.Value 0 Then Exit Sub
v = -Target.Value & "+"
Application.EnableEvents = False
Target.Value = v & Target.Address(RowAbsolute:=False, ColumnAbsolute:=False)
Application.EnableEvents = True
End Sub
--
Gary''s Student - gsnu200746


"nickra" wrote:
I know this is probably an easy one, but I can't find the right
button. Every time I type, say, -3, into a cell, it turns into -3 and
then adds the cell wherever my cursor is, like L11. So, I get 3+L11 in
the cell instead of -3. What do I need to do? It's gotta be simple, I
know.


Huh? I have no clue what you are talking about. Is there a simple
button to click to change this or something. Ic an't believe something
as simple as typing in a negative number would cause such a glitch.


What is VBA? And does this mean that everyone is used to
typing in a minus and a number in a cell and having it NOt
automatically be a negative number?t