put decimal before second last number by vba in column E

zyxw1234
Banned
Posts: 253
Joined: 22 Apr 2020, 17:24

put decimal before second last number by vba in column E

Post by zyxw1234 »

Hi
Maro will be placed in macro.xlsm
Put decimal before second last number in column E of alert..xls by vba
so the reesult will be in column E is
1410.5
1510
Thnx
plz see the uploaded file

https://chandoo.org/forum/threads/put-d ... ost-266257

Code: Select all

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 5 And Len(Target.Value) > 0 Then
        On Error Resume Next
        ASE False
        Target.Value = Target.Value / 100
        ASE True
    End If
End Sub

Sub ASE(ss)
    With Application
        .EnableEvents = ss
        .ScreenUpdating = ss
    End With
End Sub

This is not the solution that i am looking for
When I will run the macro and then the data will be changed according to the condition
& I need a single macro that does the same

User avatar
HansV
Administrator
Posts: 78471
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: put decimal before second last number by vba in column E

Post by HansV »

I cannot download files from Chandoo.org
Best wishes,
Hans

zyxw1234
Banned
Posts: 253
Joined: 22 Apr 2020, 17:24

Re: put decimal before second last number by vba in column E

Post by zyxw1234 »

Plz see the file
Sorry Sir, I forgot to upload the same in this post
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78471
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: put decimal before second last number by vba in column E

Post by HansV »

Code: Select all

Sub DivideBy100()
    Dim wbk As Workbook
    Dim wsh As Worksheet
    Dim m As Long
    Dim rng As Range
    Application.ScreenUpdating = False
    Set wbk = Workbooks.Open("Alert..xls") ' Add the path yourself
    Set wsh = wbk.Worksheets(1)
    m = wsh.Range("E" & wsh.Rows.Count).End(xlUp).Row
    For Each rng In wsh.Range("E1:E" & m)
        rng.Value = rng.Value / 100
    Next rng
    wbk.Close SaveChanges:=True
    Application.ScreenUpdating = True
End Sub
Best wishes,
Hans

zyxw1234
Banned
Posts: 253
Joined: 22 Apr 2020, 17:24

Re: put decimal before second last number by vba in column E

Post by zyxw1234 »

Thnx Alot HansV Sir for giving ur precious time to this post & helping me in solving the same
Have a Great Day
Problem Solved