Edit a Macro to find 2nd to Last Populated Column & Copy

Buns1976

Board Regular
Joined
Feb 11, 2019
Messages
194
Office Version
  1. 365
Platform
  1. Windows
Good Morning Everyone,
The code below finds the last column in my worksheet and copies/paste special/values to another sheet. I need to edit the code to find the 2nd to last populated column
and copy/paste special.

Any help would be greatly appreciated!

Thanks,
B


VBA Code:
Sub copypastevalues()
  Sheets("SCAN").Columns(Sheets("SCAN").Cells(1, Columns.Count).End(1).Column).Copy
  Sheets("SHIFT").Range("A1").PasteSpecial xlPasteValues
End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
VBA Code:
Sub copypastevalues()
  Sheets("SCAN").Columns(Sheets("SCAN").Cells(1, Columns.Count).End(1).Offset(0, -1).Column).Copy
  Sheets("SHIFT").Range("A1").PasteSpecial xlPasteValues
  Application.CutCopyMode = False
End Sub
 
Upvote 0
Solution
VBA Code:
Sub copypastevalues()
  Sheets("SCAN").Columns(Sheets("SCAN").Cells(1, Columns.Count).End(1).Offset(0, -1).Column).Copy
  Sheets("SHIFT").Range("A1").PasteSpecial xlPasteValues
  Application.CutCopyMode = False
End Sub
THANK YOU! Much appreciated!
 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,568
Members
448,972
Latest member
Shantanu2024

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