![]() |
|
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Jun 2002
Location: Croatia
Posts: 83
|
Need VBA code for changing "," to "." in cell as I tipe for instance: 4010410,1 to become 4010410.1 |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2003
Location: Luton, England.
Posts: 8,064
|
Don't understand this one.
Why can't you just type the . ?????
__________________
Regards BrianB (using XL2003 & 2010) Most problems occur from starting at the wrong place. Use a cup of coffee to speed up all Windows processes. It is easy until you know how. **FORMATTED/COMMENTED CODE IS MORE LIKELY TO GET A REPLY |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Apr 2002
Posts: 2,318
|
Try this;
ActiveCell = Replace(ActiveCell, ",", ".", 1, -1) or this for a range of cells; Selection.Replace What:=",", Replacement:=".", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False |
|
|
|
|
|
#4 | |
|
Board Regular
Join Date: Apr 2002
Posts: 2,318
|
Quote:
I expect the data is imported from another application. |
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Jun 2002
Location: Croatia
Posts: 83
|
Let's say that code should look something like this:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 2 And Target.Row > 21 Then '4010410,1 should become 4010410.1 'or by words: ' if in activecell.value string "," exists; replace the string "," to string "." end if end sub Hope you've understand my problem?! I need that string change if active cell changes. Thnx |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Mar 2003
Location: Montréal, Québec
Posts: 237
|
Don't you just have to change the Decimal symbol into the Regionnal settings from the Control Pannel ?
|
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Apr 2002
Posts: 2,318
|
Try this;
Code:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 2 And Target.Row > 21 Then On Error Resume Next Target.Value = Replace(Target.Value, ",", ".", 1, -1) End If End Sub |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|