ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Cell display after input (https://www.excelbanter.com/excel-discussion-misc-queries/159017-cell-display-after-input.html)

swiftcode

Cell display after input
 
Hi,

I am wondering if i am able to change the value of an input immendiately
after pressing enter in a cell. E.g.

If i type "1000" into a cell, after i press enter it will take the 1000/100
and display a value of "10" in the cell.

Thanks
Swiftcode

Zone[_3_]

Cell display after input
 
Copy this code. Right-click on the sheet tab, select View Code, and paste
the code in there.
James

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If VarType(Target) = vbDouble Then
Target = Target / 100
End If
Application.EnableEvents = True
End Sub


"swiftcode" wrote in message
...
Hi,

I am wondering if i am able to change the value of an input immendiately
after pressing enter in a cell. E.g.

If i type "1000" into a cell, after i press enter it will take the
1000/100
and display a value of "10" in the cell.

Thanks
Swiftcode




swiftcode

Cell display after input
 
Hi James,

Thanks for your help. Your post solved the inital question, but would it be
possible to target only a specific cell.

Thanks
Swiftcode

"Zone" wrote:

Copy this code. Right-click on the sheet tab, select View Code, and paste
the code in there.
James

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If VarType(Target) = vbDouble Then
Target = Target / 100
End If
Application.EnableEvents = True
End Sub


"swiftcode" wrote in message
...
Hi,

I am wondering if i am able to change the value of an input immendiately
after pressing enter in a cell. E.g.

If i type "1000" into a cell, after i press enter it will take the
1000/100
and display a value of "10" in the cell.

Thanks
Swiftcode





Mike H

Cell display after input
 
Hi,

add this to James' code:-

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then 'change to suit
Application.EnableEvents = False
If VarType(Target) = vbDouble Then
Target = Target / 100
End If
End If
Application.EnableEvents = True
End Sub

Mike

"swiftcode" wrote:

Hi James,

Thanks for your help. Your post solved the inital question, but would it be
possible to target only a specific cell.

Thanks
Swiftcode

"Zone" wrote:

Copy this code. Right-click on the sheet tab, select View Code, and paste
the code in there.
James

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If VarType(Target) = vbDouble Then
Target = Target / 100
End If
Application.EnableEvents = True
End Sub


"swiftcode" wrote in message
...
Hi,

I am wondering if i am able to change the value of an input immendiately
after pressing enter in a cell. E.g.

If i type "1000" into a cell, after i press enter it will take the
1000/100
and display a value of "10" in the cell.

Thanks
Swiftcode





swiftcode

Cell display after input
 
Hi James & Mike,

Thanks for your help. Really appreciate it.

Have a good day.

Rgds
Swiftcode

"Mike H" wrote:

Hi,

add this to James' code:-

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then 'change to suit
Application.EnableEvents = False
If VarType(Target) = vbDouble Then
Target = Target / 100
End If
End If
Application.EnableEvents = True
End Sub

Mike

"swiftcode" wrote:

Hi James,

Thanks for your help. Your post solved the inital question, but would it be
possible to target only a specific cell.

Thanks
Swiftcode

"Zone" wrote:

Copy this code. Right-click on the sheet tab, select View Code, and paste
the code in there.
James

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If VarType(Target) = vbDouble Then
Target = Target / 100
End If
Application.EnableEvents = True
End Sub


"swiftcode" wrote in message
...
Hi,

I am wondering if i am able to change the value of an input immendiately
after pressing enter in a cell. E.g.

If i type "1000" into a cell, after i press enter it will take the
1000/100
and display a value of "10" in the cell.

Thanks
Swiftcode





All times are GMT +1. The time now is 11:02 AM.

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