Una famiglia di software per fogli di calcolo Microsoft con strumenti per l'analisi, la creazione di grafici e la comunicazione dei dati.
Ciao Nicola,
Ciao Norman, grazie, benissimo il tuo codice, un'ultima considerazione, ho notato che nella divisione di un numero
intero tipo 784500 il tuo codice mi da 7845,00.
E' possibile visualizzarlo cosi: 7.845,00?
Credo di si! Prova:
'=========>>
Option Explicit
'--------->>
Public Sub Trasforma_cifre()
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng As Range, rCell As Range
Dim LRow As Long, i As Long
Dim CalcMode As Long
If MsgBox("Vuoi effettuare la trasformazione delle " _
& "Cifre con decimali?", _
vbInformation + vbYesNo + vbDefaultButton2) = vbNo Then
Exit Sub
End If
Set WB = ThisWorkbook
Set SH = WB.Sheets("Foglio1") '<<===== Modifica
On Error GoTo XIT
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
With SH
LRow = LastRow(SH, .Columns("C:C"))
Set Rng = .Range("C2:C" & LRow)
End With
For Each rCell In Rng.Cells
With rCell
If IsNumeric(.Value) Then
If Not CBool(InStr(.Text, ",")) Then
.Value = .Value / 100
.NumberFormat = "#,##0.00"
End If
End If
End With
Next rCell
XIT:
With Application
.Calculation = CalcMode
.ScreenUpdating = True
End With
End Sub
'--------->>
Public Function LastRow(SH As Worksheet, _
Optional Rng As Range, _
Optional minRow As Long = 1)
If Rng Is Nothing Then
Set Rng = SH.Cells
End If
On Error Resume Next
LastRow = Rng.Find(What:="*", _
after:=Rng.Cells(1), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
If LastRow < minRow Then
LastRow = minRow
End If
End Function
'<<=========
===
Regards,
Norman