Results 1 to 4 of 4

Thread: VBA required to delimit cells with Rules applied over it.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    May 2020
    Posts
    2
    Rep Power
    0

    VBA required to delimit cells with Rules applied over it.

    Hi Friends,

    Firstly Thanks to DocAElstein for reffering me to this Forum.


    i need a help on fixing an existing VBA script,

    Function of Existing Script:
    i have hundreds of addresses to Delimit into seperate cells as shown in the attached sample file(Address sheet.xlsm)
    i have a script to delimit those addresses Available in A column to the B,C,D & E column.
    COlumn A: contains full address
    COlumn B: Door number
    COlumn C: Direction (N,E,S,W)
    COlumn D: Street Name
    COlumn E: Street Type

    Twist is at Directions(N,E,S,W), sometimes it comes next to Door# (or) at the end of an address.
    existing script, even do that work perfectly.

    Current Requirement:
    Now some addresses comes with different scenarios,
    i have highlighted in yellow colour in the attached excel(green higlighted cells are working fine with existing script).
    if single Numberical value (1,2,3.4,5,6,7,8,9) comes in C column,it should be moved to the D column
    by adding text like(1st,2nd,3rd,4th,5th,6th,7th,8th,9th).

    Could anyone please help me to resolve this issue.

    HTML Code:
    Sub Demo1()
        Dim V(), W(), R&, S, C%
            V = Application.Trim(Range("A2", [A1].End(xlDown)))
            ReDim W(1 To UBound(V), 3)
        For R = 1 To UBound(V)
               S = Split(V(R, 1))
            If IsNumeric(S(0)) Then
                    W(R, 0) = S(0)
                If Len(S(1)) = 1 Then
                    W(R, 1) = S(1):  W(R, 2) = S(2):  W(R, 3) = S(3)
                ElseIf Len(S(UBound(S))) = 1 Then
                    W(R, 1) = S(UBound(S)):  W(R, 2) = S(1):  W(R, 3) = S(2)
                Else
                    If UBound(S) = 3 Then W(R, 2) = S(1) & " " & S(2) Else W(R, 2) = S(1)
                    W(R, 3) = S(UBound(S))
                End If
            Else
               W(R, 0) = Left(S(0), Len(S(0)) - 1):  W(R, 1) = Right(S(0), 1):  W(R, 2) = S(1): W(R, 3) = S(2)
            End If
        Next
            [B2:E2].Resize(R - 1) = W
    End Sub
    Thanks in Advance.








    Cross Posts:
    https://www.excelforum.com/excel-pro...ied-on-it.html
    https://www.excelguru.ca/forums/show...plied-over-it&
    Attached Files Attached Files
    Last edited by DocAElstein; 06-01-2020 at 11:40 PM.

Similar Threads

  1. Excel VBA/Macro Help required URGENT
    By shushom in forum Excel Help
    Replies: 6
    Last Post: 09-20-2016, 11:24 PM
  2. Replies: 10
    Last Post: 11-21-2013, 04:41 PM
  3. Replies: 12
    Last Post: 07-26-2013, 07:39 AM
  4. VBA Program to Compare 4 Columns in Excel (Required)
    By vijaysram in forum Excel Help
    Replies: 11
    Last Post: 06-26-2013, 10:53 AM
  5. Creating Powerpoint Slides: Rules
    By Transformer in forum Powerpoint Help
    Replies: 0
    Last Post: 05-17-2013, 08:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •