+ Reply to Thread
Results 1 to 2 of 2

Comparison Macro

  1. #1
    Registered User
    Join Date
    09-20-2004
    Posts
    3

    Red face Comparison Macro

    To start, I'm a newbie to writing macros and have done most of it with the "wizard". In the macro below, I'm very simply trying compare one cell to the cell directly below it (column A). If they're different, I need to insert a row and if not, just continue down the list. It's probably a very simple fix, but again I'm a newbie so any help would be greatly apprecitaed!


    Dim cell As Range
    Application.ScreenUpdating = False
    Set cell = Range("A65536").End(xlUp)
    Do
    Set cell = cell(0, 1)
    If cell(0, 1) <> cell(0, 2) Then
    cell(0, 2).EntireRow.Insert
    End If
    Loop Until cell.Address = "$A$2"
    Application.ScreenUpdating = True
    End Sub

  2. #2
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451
    minor change


    Sub macro()
    Dim cell As Range
    Application.ScreenUpdating = False
    Set cell = Range("A65536").End(xlUp)
    Do
    If cell(0, 1) <> cell(1, 1) Then
    cell(1, 1).EntireRow.Insert
    Set cell = cell(0, 1)
    End If
    Set cell = cell(0, 1)
    Loop Until cell.Address = "$A$2"

    Application.ScreenUpdating = True
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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