Code help need

Bobmn4

New Member
Joined
Dec 3, 2020
Messages
11
Office Version
  1. 365
Platform
  1. Windows
I am trying to get my copied Data to paste in the very next box but the DEBUG stops on the following any advise to get it to drop down to the next blank box I cant set a specific box because the information being copy and pasted varies. this code literally worked for weeks and just stopped today

Range("A2:J1003").Select
Selection.Copy
Sheets("EOC").Select
Range("A1").Select

Selection.End(xlDown).Offset(1, 0).Select

ActiveSheet.Paste
 
If not try
VBA Code:
Sub Bobmn()
   Dim NxtRw As Long
  
   NxtRw = Sheets("EOC").Range("A" & Rows.Count).End(xlUp).Offset(1).Row
   With ActiveSheet
      .Range("A1:J1").AutoFilter 10, "=*ac-**", xlOr, "=*Clinical Screening for**"
      .AutoFilter.Range.Offset(1).Copy Sheets("EOC").Range("A" & NxtRw)
      .AutoFilterMode = False
   End With
   With Sheets("EOC")
      With .Range("A" & NxtRw, .Range("A" & Rows.Count).End(xlUp)).Resize(, 10).Interior
         .Pattern = xlSolid
         .PatternColorIndex = xlAutomatic
         .Color = 5287936
         .TintAndShade = 0
         .PatternTintAndShade = 0
      End With
   End With
End Sub

Ironically the old code that stopped working started working again perfectly so I just went back to the old version that stopped and its working perfect with nothing done to it
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Glad it's sorted & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,753
Messages
6,126,674
Members
449,327
Latest member
John4520

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