copy Visible columns from A to U the last row

Rfcolon428

New Member
Joined
Feb 1, 2019
Messages
8
Dim wb As Workbook
Dim sht As Worksheet
Dim LastRow As Long
Dim destwb As Workbook
Dim destsht As Worksheet
Dim destLR As Long
Dim rng As Range




Set wb = ThisWorkbook
Set sht = wb.Sheets("Open PO Raw Data")
Set destwb = Workbooks.Open("C:\Users\name\Desktop\ALL PO RAW DATA 1-18 to present.xlsx")
destLR = Cells(Rows.Count, "A").End(xlUp).Row


MsgBox destLR




ThisWorkbook.ActiveSheet.Activate
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
MsgBox LastRow
Columns("A2:U" & LastRow).SpecialCells(xlCellTypeVisible).Copy
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Try the following


Code:
Dim wb As Workbook
Dim sht As Worksheet, destsht As Worksheet
Dim destLR As Long, LastRow As Long


Set wb = ThisWorkbook
Set sht = wb.Sheets("Open PO Raw Data")
LastRow = sht.Cells(Rows.Count, "A").End(xlUp).Row


Set destwb = Workbooks.Open("C:\Users\name\Desktop\ALL PO RAW DATA 1-18 to present.xlsx")
Set destsht = destwb.Sheets(1)
destLR = destsht.Cells(Rows.Count, "A").End(xlUp).Row + 1


sht.Range("A2:U" & LastRow).SpecialCells(xlCellTypeVisible).Copy destsht.Range("A" & destLR)


destwb.Save
destwb.Close
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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