Copy from one sheet to another

Sharid

Well-known Member
Joined
Apr 22, 2007
Messages
1,066
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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
.
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,223,898
Messages
6,175,272
Members
452,628
Latest member
dd2

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