Find Last Row/Column With Data Multiple Places in Macro Copy and Paste to Another Sheet Range

Rfez1063

New Member
Joined
Feb 28, 2017
Messages
4
Hello,

I am currently trying to write a macro that performs multiple functions at once. The trick here is that I need to scan columns a thru d in a source data sheet, find the last row with data, sort the information, eliminate any rows with a zero value in column b, and return only rows that contain "N1G' in column A. Then I need the macro to scan the remaining data, find the last row (populated with data)copy and paste special values in a2 of another spread sheet, then resort the information by column e of the receiving spread sheet.

I've tried several ways but I either get a various error messages including duplicate

This is what I currently have... the problem is I end up with multiple blank rows at the top of the receiving spread sheet.
Sub Process()
'
' Process Macro
'
'
Sheets("Statement Check").Select
Sheets("Macro").Visible = True
Sheets("FT10 Original").Select
Columns("A:D").Select
Selection.Copy
Sheets("Macro").Select
Columns("A:A").Select
ActiveSheet.Paste
Dim LR As Long, i As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = LR To 2 Step -1
If Not Range("A" & i).Value Like "N1G*" Or Range("B" & i).Value = 0 Then Rows(i).Delete
Next i

Range("A2:D1726").Select
Selection.Copy
Sheets("Statement Check").Select
ActiveWindow.SmallScroll Down:=-15
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Macro").Select
Application.CutCopyMode = False
Selection.ClearContents
Sheets("Macro").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Statement Check").Select
Range("A2").Select
Range("A2:E290").Select
ActiveWorkbook.Worksheets("Statement Check").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Statement Check").Sort.SortFields.Add Key:=Range( _
"E2:E290"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Statement Check").Sort
.SetRange Range("A2:E290")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A2").Select
ActiveWindow.SmallScroll Down:=255
ActiveWindow.ScrollRow = 253
ActiveWindow.ScrollRow = 246
ActiveWindow.ScrollRow = 238
ActiveWindow.ScrollRow = 229
ActiveWindow.ScrollRow = 221
ActiveWindow.ScrollRow = 215
ActiveWindow.ScrollRow = 202
ActiveWindow.ScrollRow = 193
ActiveWindow.ScrollRow = 183
ActiveWindow.ScrollRow = 172
ActiveWindow.ScrollRow = 161
ActiveWindow.ScrollRow = 146
ActiveWindow.ScrollRow = 131
ActiveWindow.ScrollRow = 121
ActiveWindow.ScrollRow = 108
ActiveWindow.ScrollRow = 93
ActiveWindow.ScrollRow = 80
ActiveWindow.ScrollRow = 70
ActiveWindow.ScrollRow = 59
ActiveWindow.ScrollRow = 40
ActiveWindow.ScrollRow = 33
ActiveWindow.ScrollRow = 27
ActiveWindow.ScrollRow = 25
ActiveWindow.ScrollRow = 23
ActiveWindow.ScrollRow = 21
ActiveWindow.ScrollRow = 19
ActiveWindow.ScrollRow = 16
ActiveWindow.ScrollRow = 14
ActiveWindow.ScrollRow = 12
ActiveWindow.ScrollRow = 10
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 2
End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,214,784
Messages
6,121,536
Members
449,037
Latest member
tmmotairi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top