Results 1 to 6 of 6

VBA cleanup

Threaded View

paul_j_ VBA cleanup 06-09-2015, 02:07 AM
SamT Re: VBA cleanup 06-09-2015, 03:39 AM
romperstomper Re: VBA cleanup 06-09-2015, 04:05 AM
SamT Re: VBA cleanup 06-09-2015, 05:25 AM
romperstomper Re: VBA cleanup 06-09-2015, 05:43 AM
TMS Re: VBA cleanup 06-09-2015, 06:21 AM
  1. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,377

    Re: VBA cleanup

    Maybe this:

    Option Explicit
    
    Sub sModifyColumnA()
    
    Dim lLR As Long, i As Long
    Dim sString As String
    Dim vArray
    
    lLR = Range("A" & Rows.Count).End(xlUp).Row
    ReDim vArray(1 To lLR)
    
    For i = 1 To lLR
        sString = "=IF($A" & i & "="""","""",COUNTIFS($A$2:$A" & i & ",$A" & i & ",$F$2:$F" & i & ",$F" & i & "))"
        If Evaluate(sString) = "" Then
            vArray(i) = ""
        Else
            vArray(i) = IIf((Evaluate(sString)) > 1, Range("A" & i).Value & "-" & Evaluate(sString), Range("A" & i).Value)
        End If
    Next 'i
    
    Application.ScreenUpdating = False
    Range("A1").Resize(lLR, 1) = Application.Transpose(vArray)
    Application.ScreenUpdating = True
    
    End Sub

    Regards, TMS
    Attached Files Attached Files
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA Cleanup
    By specialk9203 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2014, 09:50 AM
  2. [SOLVED] Code Cleanup Help
    By maddog9486 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-13-2011, 02:19 PM
  3. Code cleanup
    By timlocke in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-10-2011, 08:01 PM
  4. String Cleanup
    By TheAndarious in forum Excel General
    Replies: 1
    Last Post: 07-21-2010, 03:59 PM
  5. if (formula cleanup)
    By simpson in forum Excel General
    Replies: 8
    Last Post: 05-19-2010, 08:08 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1