Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Could You Look over And Maybe Clean up
I have Store Nuber in (B2) And If SOD in I3 is 0 it will move row 2 as well And MIDC is the Warehouse name Sub MIDC() Const SOD = "I3" Dim EmptyRow As Long Dim MovedCount As Long Dim LC As Long EmptyRow = Range("I" & Rows.Count).End(xlUp).Row + 3 Application.ScreenUpdating = False Do Until (MovedCount + LC) = EmptyRow If Range(SOD).Offset(LC, 0) = 0 Then Rows(Range(SOD).Offset(LC, 0).Row & _ ":" & Range(SOD).Offset(LC, 0).Row).Copy Rows(EmptyRow & ":" & EmptyRow).Select ActiveSheet.Paste Rows(Range(SOD).Offset(LC, 0).Row & ":" & _ Range(SOD).Offset(LC, 0).Row).Delete Shift:=xlUp MovedCount = MovedCount + 3 LC = LC - 1 Else LC = LC + 1 End If Loop Range(SOD).Select Application.ScreenUpdating = True Dim LastRowUsed As Long Dim TestValue As Long LastRowUsed = Range("C" & Rows.Count).End(xlUp).Row TestValue = 19999 Range("C4").Select Application.ScreenUpdating = False Do Until TestValue 99999 If ActiveCell.Offset(-1, 0) <= TestValue And _ ActiveCell.Value TestValue Then Selection.EntireRow.Insert LastRowUsed = LastRowUsed + 1 TestValue = TestValue + 10000 End If ActiveCell.Offset(1, 0).Activate If ActiveCell.Row LastRowUsed Then Exit Do End If Loop Columns("B:I").Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do I email amacro? | Excel Worksheet Functions | |||
error when running cut & paste macro | Excel Worksheet Functions | |||
Search, Copy, Paste Macro in Excel | Excel Worksheet Functions | |||
Closing File Error | Excel Discussion (Misc queries) | |||
Highlight Range - wrong macro, please edit. | Excel Worksheet Functions |