ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro to expdite editing cell (https://www.excelbanter.com/excel-programming/279899-macro-expdite-editing-cell.html)

todd

macro to expdite editing cell
 
I posted this once but not shwoing up after atleast an hour

I have a number in a cell I need to edit the cell by going
in and adding an = sign in front of the original number,
placing a plus just after the original number , then
entering a new number

so original cell might look like 5.734

then need to add 4.375

I need to keep both numbers so need to do calc but want to
cut down on key strokes

when done needs to read =5.734+4.375 ( a simple calc
giving me the sum of the 2 numbers in the cell

The goal is tohave a short cut key to add an = sign to the
left of a single number then jump to the right of it, add
a plus sign, and give me a blinking cursor to type in my
number I want to add to the back of it.

Thanks much

Todd



[email protected]

macro to expdite editing cell
 
Watch for linewrap.

Sub CreateFormula()
Dim dblNum As Double, dblAdd As Double

dblNum = ActiveCell.Value
dblAdd = Application.InputBox("Please enter the number to add.",
Type:=2)
ActiveCell.Formula = "= " & dblNum & "+" & dblAdd & ""

End Sub


Tested using Excel 97SR2 on Windows 98SE,

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------
I posted this once but not shwoing up after atleast an hour

I have a number in a cell I need to edit the cell by going
in and adding an = sign in front of the original number,
placing a plus just after the original number , then
entering a new number

so original cell might look like 5.734

then need to add 4.375

I need to keep both numbers so need to do calc but want to
cut down on key strokes

when done needs to read =5.734+4.375 ( a simple calc
giving me the sum of the 2 numbers in the cell

The goal is tohave a short cut key to add an = sign to the
left of a single number then jump to the right of it, add
a plus sign, and give me a blinking cursor to type in my
number I want to add to the back of it.

Thanks much

Todd



Don Guillett[_4_]

macro to expdite editing cell
 
I gave you an answer.

"todd" wrote in message
...
I posted this once but not shwoing up after atleast an hour

I have a number in a cell I need to edit the cell by going
in and adding an = sign in front of the original number,
placing a plus just after the original number , then
entering a new number

so original cell might look like 5.734

then need to add 4.375

I need to keep both numbers so need to do calc but want to
cut down on key strokes

when done needs to read =5.734+4.375 ( a simple calc
giving me the sum of the 2 numbers in the cell

The goal is tohave a short cut key to add an = sign to the
left of a single number then jump to the right of it, add
a plus sign, and give me a blinking cursor to type in my
number I want to add to the back of it.

Thanks much

Todd





todd

macro to expdite editing cell
 
This is a totally different question - I used your macro
for my other question - it is great!
-----Original Message-----
I gave you an answer.

"todd" wrote in message
...
I posted this once but not shwoing up after atleast an

hour

I have a number in a cell I need to edit the cell by

going
in and adding an = sign in front of the original number,
placing a plus just after the original number , then
entering a new number

so original cell might look like 5.734

then need to add 4.375

I need to keep both numbers so need to do calc but want

to
cut down on key strokes

when done needs to read =5.734+4.375 ( a simple calc
giving me the sum of the 2 numbers in the cell

The goal is tohave a short cut key to add an = sign to

the
left of a single number then jump to the right of it,

add
a plus sign, and give me a blinking cursor to type in my
number I want to add to the back of it.

Thanks much

Todd




.


todd

macro to expdite editing cell
 
thanks I will try
-----Original Message-----
Watch for linewrap.

Sub CreateFormula()
Dim dblNum As Double, dblAdd As Double

dblNum = ActiveCell.Value
dblAdd = Application.InputBox("Please enter the

number to add.",
Type:=2)
ActiveCell.Formula = "= " & dblNum & "+" & dblAdd & ""

End Sub


Tested using Excel 97SR2 on Windows 98SE,

HTH
Paul
----------------------------------------------------------

----------------------------------------------------
Be advised to back up your WorkBook before attempting to

make changes.
----------------------------------------------------------

----------------------------------------------------
I posted this once but not shwoing up after atleast an

hour

I have a number in a cell I need to edit the cell by

going
in and adding an = sign in front of the original number,
placing a plus just after the original number , then
entering a new number

so original cell might look like 5.734

then need to add 4.375

I need to keep both numbers so need to do calc but want

to
cut down on key strokes

when done needs to read =5.734+4.375 ( a simple calc
giving me the sum of the 2 numbers in the cell

The goal is tohave a short cut key to add an = sign to

the
left of a single number then jump to the right of it,

add
a plus sign, and give me a blinking cursor to type in my
number I want to add to the back of it.

Thanks much

Todd


.


todd

macro to expdite editing cell
 
I ran it but ran into a snag

works fine if just have a single number in cell

but if have this "=47.25+4.375" & say add 4.5 to it

it puts this in cell

= 51.625+4.5 It is adding the two original numbers
together then adding my new number to the back of it

I probably did not clarify

if I have 47.25+4.375 already in cell and want to add 4.5
to it then when done that action I need the cell to have
the following in it:

"=47.25+4.375+4.5

In the cell to start with I may have one number or there
may be up to 3 or 4 numbers added together with + signs
between them.

Thanks








-----Original Message-----
Watch for linewrap.

Sub CreateFormula()
Dim dblNum As Double, dblAdd As Double

dblNum = ActiveCell.Value
dblAdd = Application.InputBox("Please enter the

number to add.",
Type:=2)
ActiveCell.Formula = "= " & dblNum & "+" & dblAdd & ""

End Sub


Tested using Excel 97SR2 on Windows 98SE,

HTH
Paul
----------------------------------------------------------

----------------------------------------------------
Be advised to back up your WorkBook before attempting to

make changes.
----------------------------------------------------------

----------------------------------------------------
I posted this once but not shwoing up after atleast an

hour

I have a number in a cell I need to edit the cell by

going
in and adding an = sign in front of the original number,
placing a plus just after the original number , then
entering a new number

so original cell might look like 5.734

then need to add 4.375

I need to keep both numbers so need to do calc but want

to
cut down on key strokes

when done needs to read =5.734+4.375 ( a simple calc
giving me the sum of the 2 numbers in the cell

The goal is tohave a short cut key to add an = sign to

the
left of a single number then jump to the right of it,

add
a plus sign, and give me a blinking cursor to type in my
number I want to add to the back of it.

Thanks much

Todd


.


[email protected]

macro to expdite editing cell
 
Try me.

Sub CreateFormula()
Dim dblNum As Double, dblAdd As Double

dblAdd = Application.InputBox("Please enter the number to add.",
Type:=2)

If Not ActiveCell.HasFormula Then
dblNum = ActiveCell.Value
ActiveCell.Formula = "= " & dblNum & "+" & dblAdd & ""
Else
ActiveCell.Formula = ActiveCell.Formula & "+" & dblAdd
End If

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

I ran it but ran into a snag

works fine if just have a single number in cell

but if have this "=47.25+4.375" & say add 4.5 to it

it puts this in cell

= 51.625+4.5 It is adding the two original numbers
together then adding my new number to the back of it

I probably did not clarify

if I have 47.25+4.375 already in cell and want to add 4.5
to it then when done that action I need the cell to have
the following in it:

"=47.25+4.375+4.5

In the cell to start with I may have one number or there
may be up to 3 or 4 numbers added together with + signs
between them.

Thanks



Tom Ogilvy

macro to expdite editing cell
 
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim sForm as String, sVal as String
On Error GoTo ErrHandler
If Target.Count 1 Then Exit Sub
If Target.Column = 1 Then
sVal = Target.Value
If sVal = "" Then Exit Sub
Application.EnableEvents = False
Application.Undo
sForm = Target.Formula
If Left(sForm, 1) < "=" Then _
sForm = "=" & sForm
sForm = sForm & "+" & sVal
Target.Formula = sForm
End If
ErrHandler:
Application.EnableEvents = True
End Sub

Right click on the sheet tab and paste in the code.

Now start typing numbers into column A.

Just overtype any existing number and it will build your formula.

--
regards,
Tom Ogilvy

todd wrote in message
...
I posted this once but not shwoing up after atleast an hour

I have a number in a cell I need to edit the cell by going
in and adding an = sign in front of the original number,
placing a plus just after the original number , then
entering a new number

so original cell might look like 5.734

then need to add 4.375

I need to keep both numbers so need to do calc but want to
cut down on key strokes

when done needs to read =5.734+4.375 ( a simple calc
giving me the sum of the 2 numbers in the cell

The goal is tohave a short cut key to add an = sign to the
left of a single number then jump to the right of it, add
a plus sign, and give me a blinking cursor to type in my
number I want to add to the back of it.

Thanks much

Todd





Dave Peterson[_3_]

fantastic but column question
 
This line checks for column A:
If Target.Column = 1 Then

If Target.Column = 2 Then
would check for B.

Do you mean that you want it to work on either A, B or C?
If target.column < 4 then

todd wrote:

Thanks I could not wait and plugged it in.

If need be I can work with it in column A but I am
wondering if there is a poiojnt in the coode where I can
modify it to work in say for example column B or Column C.

TOdd Frisch

Anyway this is very cool - I appreciate your time.
-----Original Message-----
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim sForm as String, sVal as String
On Error GoTo ErrHandler
If Target.Count 1 Then Exit Sub
If Target.Column = 1 Then
sVal = Target.Value
If sVal = "" Then Exit Sub
Application.EnableEvents = False
Application.Undo
sForm = Target.Formula
If Left(sForm, 1) < "=" Then _
sForm = "=" & sForm
sForm = sForm & "+" & sVal
Target.Formula = sForm
End If
ErrHandler:
Application.EnableEvents = True
End Sub

Right click on the sheet tab and paste in the code.

Now start typing numbers into column A.

Just overtype any existing number and it will build your

formula.

--
regards,
Tom Ogilvy

todd wrote in message
...
I posted this once but not shwoing up after atleast an

hour

I have a number in a cell I need to edit the cell by

going
in and adding an = sign in front of the original number,
placing a plus just after the original number , then
entering a new number

so original cell might look like 5.734

then need to add 4.375

I need to keep both numbers so need to do calc but want

to
cut down on key strokes

when done needs to read =5.734+4.375 ( a simple calc
giving me the sum of the 2 numbers in the cell

The goal is tohave a short cut key to add an = sign to

the
left of a single number then jump to the right of it,

add
a plus sign, and give me a blinking cursor to type in my
number I want to add to the back of it.

Thanks much

Todd




.


--

Dave Peterson


todd

yes that's it
 
The issue is my working column or target column will not
always be in A sometimes B or C

thanks will use this
-----Original Message-----
This line checks for column A:
If Target.Column = 1 Then

If Target.Column = 2 Then
would check for B.

Do you mean that you want it to work on either A, B or C?
If target.column < 4 then

todd wrote:

Thanks I could not wait and plugged it in.

If need be I can work with it in column A but I am
wondering if there is a poiojnt in the coode where I can
modify it to work in say for example column B or Column

C.

TOdd Frisch

Anyway this is very cool - I appreciate your time.
-----Original Message-----
Private Sub Worksheet_Change(ByVal Target As

Excel.Range)
Dim sForm as String, sVal as String
On Error GoTo ErrHandler
If Target.Count 1 Then Exit Sub
If Target.Column = 1 Then
sVal = Target.Value
If sVal = "" Then Exit Sub
Application.EnableEvents = False
Application.Undo
sForm = Target.Formula
If Left(sForm, 1) < "=" Then _
sForm = "=" & sForm
sForm = sForm & "+" & sVal
Target.Formula = sForm
End If
ErrHandler:
Application.EnableEvents = True
End Sub

Right click on the sheet tab and paste in the code.

Now start typing numbers into column A.

Just overtype any existing number and it will build

your
formula.

--
regards,
Tom Ogilvy

todd wrote in message
...
I posted this once but not shwoing up after atleast

an
hour

I have a number in a cell I need to edit the cell by

going
in and adding an = sign in front of the original

number,
placing a plus just after the original number , then
entering a new number

so original cell might look like 5.734

then need to add 4.375

I need to keep both numbers so need to do calc but

want
to
cut down on key strokes

when done needs to read =5.734+4.375 ( a simple calc
giving me the sum of the 2 numbers in the cell

The goal is tohave a short cut key to add an = sign

to
the
left of a single number then jump to the right of it,

add
a plus sign, and give me a blinking cursor to type

in my
number I want to add to the back of it.

Thanks much

Todd




.


--

Dave Peterson

.



All times are GMT +1. The time now is 03:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com