View Single Post
 
Old 01-13-2015, 01:31 PM
charlesdh charlesdh is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

Hi,

I modified Macopod code see if this works.

Code:
Sub Demo()
Dim lRow As Long, lCol As Long, i As Long, j As Long, SBar As Boolean
With Application
  SBar = .DisplayStatusBar
  .DisplayStatusBar = True
  .ScreenUpdating = False
  .Calculation = xlManual
End With
''' changed to this '''
ThisWorkbook.Worksheets("Sheet1").UsedRange.Copy Destination:=ThisWorkbook.Worksheets("Sheet2").Range("A1")
''''''''''''''''''''''''''''''
With ThisWorkbook.Worksheets("Sheet2").UsedRange
  lRow = .Range("R65536").End(xlUp).Row ''' changed this '''
  lCol = .Cells.SpecialCells(xlCellTypeLastCell).Column
  For i = lRow To 1 Step -1
    Application.StatusBar = "Processing row " & i
    If .Cells(i, lCol).Value = .Cells(i + 1, lCol).Value Then
      For j = 1 To lCol - 1
        If Len(Trim(.Cells(i, j).Value)) > 0 Then
          .Cells(i + 1, j).Value = .Cells(i, j).Text
          Exit For
        End If
      Next
      .Rows(i).EntireRow.Delete
    End If
  Next
End With
With Application
  .Calculation = xlAutomatic
  .StatusBar = False
  .DisplayStatusBar = SBar
  .ScreenUpdating = True
End With
End Sub
Reply With Quote