Whenever I get focus into one particular cell, and if that cell contains a value which is less than 2, then the content in that cell should be multiplied by 60.
BTW, I can get focus into one particular cell by using navigation keys, or by clicking on one partiuclar cell or anything.
For example, I got focus into one particular cell which has a value 1.5. Then, my VBA program should automatically convert that cell value with 90 as 60*1.5=90.
I don't know much about programming in Excel. I can't open most of the sites due to company security policies.
Can anyone please help me on this!
Say the cell in question is cell B9. Put the following event macro in the worksheet code area:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim B9 As Range
Set B9 = Range("B9")
If Intersect(Target, B9) Is Nothing Then
Else
If B9 < 2 Then B9 = 60 * B9
End If
End Sub
Because it is worksheet code, it is very easy to install and automatic to use:
If you have any concerns, first try it on a trial worksheet.
If you save the workbook, the macro will be saved with it. If you are using a version of Excel later then 2003, you must save the file as .xlsm rather than .xlsx
To remove the macro:
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
and
http://msdn.microsoft.com/en-us/library/ee814735(v=office.14).aspx
To learn more about Event Macros (worksheet code), see:
http://www.mvps.org/dmcritchie/excel/event.htm
Macros must be enabled for this to work!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With