Copy from one sheet to another

Sharid

Well-known Member
Joined
Apr 22, 2007
Messages
1,064
Office Version
  1. 2016
Platform
  1. Windows
In Sheet3 "FB URL Filter" in Column AJ I have URLs, I need to copy and paste these URLS into Sheet2 "Url List"

When I click on the command button, I want it to copy the urls upto the last row of data in AJ and paste it into Sheet 2 Column A2

I have been strugling on this one,
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
.
This is one of many methods :

Code:
Option Explicit


Sub Copy_n_Paste()
On Error Resume Next


    Dim rng As Range, destRow As Long
    Dim shtSrc As Worksheet, shtDest As Worksheet
    Dim c As Range
        
    With Application
        .ScreenUpdating = False
        .DisplayStatusBar = False
        .Calculation = xlCalculationManual
        .EnableEvents = False
    End With
    
    Set shtSrc = Sheets("Sheet3")    'source sheet
    Set shtDest = Sheets("Sheet2")    'destination sheet
    destRow = 1 'start copying to this row


    'don't scan the entire column...
    Set rng = Application.Intersect(shtSrc.Range("AJ:AJ"), shtSrc.UsedRange)
    For Each c In rng.Cells
        If c.Value <> "" Then
            
            c.Copy shtDest.Cells(destRow, 1)
          
            destRow = destRow + 1


        End If
    Next
    shtDest.Range("A1").Value = "Url List"
    
    With Application
        .ScreenUpdating = True
        .DisplayStatusBar = True
        .Calculation = xlCalculationAutomatic
        .EnableEvents = True
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,561
Messages
6,114,315
Members
448,564
Latest member
ED38

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