여러가지 편리한 기능들이 무궁무진한 엑셀, 다들 많이 사용하고 계시지요? 하지만 많은 분들이 정말 기초적인 것만 반복해서 사용하시는 경우가 많은 것 같아요. 오늘은 엑셀 VPA 편집기 사용법에 대해 알려드릴께요.
예제) 여러 숫자를 소숫점 1자리면 *10, 소숫점 *100, 소숫점 3자리면 *1000으로 자동으로 바꾸기
DATA | 자동변환하기 | ||||||
10.1 | 101 | ||||||
50.253 | 50253 | ||||||
10.555 | 10555 | ||||||
9.1 | 91 | ||||||
3.524 |
|
3524 | |||||
11.3 | 113 | ||||||
3.235 | 3235 | ||||||
95.1 | 95.1 | ||||||
4.564 | 4.564 | ||||||
50.12 | 5012 | ||||||
8.356 | 8356 | ||||||
7.8 | 78 | ||||||
8.45 | 845 | ||||||
1.1 | 11 | ||||||
99.87 | 9987 |
Sub AdjustNumbersByDecimalPlaces()
Dim rng As Range
Dim cell As Range
Dim decimalPlaces As Integer
Dim multiplier As Double
‘ Define the range you want to adjust
Set rng = Selection ‘ or set to a specific range like Range(“A1:A100”)
‘ Loop through each cell in the range
For Each cell In rng
If IsNumeric(cell.Value) Then
decimalPlaces = Len(cell.Value) – InStr(1, cell.Value, “.”)
If decimalPlaces = 1 Then
multiplier = 10
ElseIf decimalPlaces = 2 Then
multiplier = 100
ElseIf decimalPlaces = 3 Then
multiplier = 1000
Else
multiplier = 1 ‘ No change if not 1, 2, or 3 decimal places
End If
cell.Value = cell.Value * multiplier
End If
Next cell
End Sub
Alt + Q 를 눌러 VPN 편집기를 닫습니다.
엑셀로 돌아가 조정할 셀 범위를 선택합니다.
Alt + F8을 누릅니다.
DATA | 자동변환하고 싶습니다. | ||||||
101 | 101 | ||||||
50253 | 50253 | ||||||
10555 | 10555 | ||||||
91 | 91 | ||||||
3524 |
|
3524 | |||||
113 | 113 | ||||||
3235 | 3235 | ||||||
951 | 95.1 | ||||||
4564 | 4.564 | ||||||
5012 | 5012 | ||||||
8356 | 8356 | ||||||
78 | 78 | ||||||
845 | 845 | ||||||
11 | 11 | ||||||
9987 | 9987 |