counting number in a cell with + sign

annadinesh

Board Regular
Joined
Mar 1, 2017
Messages
105
Hello Sir,

please help me with VBA

i want that i want to enter few numbers in a same cell . like i am counting number of currency received in a single cell
2 1 2 3 4 1 2



and when i double click on that cell it should show me the entry as

+2+1+2+3+4+1+2


Pls help

regards
Dinesh Saha
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi, welcome to the forum.

You can give this a try sheet event code a try.

Change the range of cells where you want this action to occur.

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("A1:A100")) Is Nothing Then
    Target.Value = "'" & Replace(Target.Value, " ", "+")
    Cancel = True
End If
End Sub
 
Last edited:
Upvote 0
i try the same, but not works

Hi, where did you put the code? Do you get any errors when executing? Do you get a wrong result? The more detail you can provide the better.
 
Upvote 0
i have put the code in <acronym title="vBulletin" style="border-width: 0px 0px 1px; border-bottom-style: dotted; border-bottom-color: rgb(0, 0, 0); cursor: help; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">VB</acronym> page under Sheet 1

No error found while executing

But Result not working

how can i send you a video file
 
Upvote 0
good morning

actually when i try to double click on the cell where i entered the value the result showing as the last number with a " ' "

like if I entered the following values in a cell one by one

i.e 1 5 3 2 4 1 6

after entering the last value the cell should shows the addition of the value i.e 22 and

after double click on that cell the value is showing only '6 on that cell,
i want that it should show =1 + 5 + 3 + 2 + 4 + 1 + 6

that means i have entered the following no. of Notes received in a cell
 
Upvote 0
Good Morning;

i want that it should show =1 + 5 + 3 + 2 + 4 + 1 + 6

So you want a formula in the cell after the double click? If so give this a try:

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("A1:A100")) Is Nothing Then
    Target.Formula = "=" & Replace(Target.Value, " ", "+")
    Cancel = True
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,557
Messages
6,114,287
Members
448,562
Latest member
Flashbond

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top