Transfer data from one worksheet to another

JayB0730

Board Regular
Joined
Oct 22, 2014
Messages
64
Hello,

I have the following vba code that works to a degree; however, I want to make a few changes.

1. Instead of the logic looking for any rows with data in column 37, I want it to find specific values (e.g. "Apple") instead.
2. Paste the information into the new sheet without any formatting.

Code:
Sub SelectDestruct()   Dim Ar As Areas
   Dim Rng As Range
   
   Sheets("Destination_Sheet").UsedRange.Offset(1).Clear
   On Error Resume Next
   Set Ar = Sheets("Origin_Sheet").Columns(37).SpecialCells(xlCellTypeConstants, xlTextValues).Areas
   On Error GoTo 0
   If Ar Is Nothing Then
      MsgBox "Nothing to do!"
      Exit Sub
   End If
   For Each Rng In Ar
      Rng.Offset(, -35).Resize(, 12).Copy Sheets("Destination_Sheet").Range("A" & Rows.Count).End(xlUp).Offset(1)
   Next Rng
Call Confirmation
End Sub

TIA!

Jay
 

Some videos you may like

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,530
Office Version
  1. 365
Platform
  1. Windows
Untested, but try
Code:
Sub SelectDestruct()
   
   Sheets("Destination_Sheet").UsedRange.Offset(1).Clear
   With ActiveSheet
      If .AutoFilterMode Then .AutoFilterMode = False
      .Range("A1").UsedRange.AutoFilter 37, "Apple"
      .AutoFilter.Range.Offset(1).Copy
      Sheets("Destination_Sheet").Range("A" & Rows.Count).End(xlUp).Offset (1)
      .AutoFilterMode = False
   End With
Call Confirmation
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,109,337
Messages
5,528,108
Members
409,802
Latest member
joeino

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top