Find and Select Last Column With Data Based On ROW 1

Buns1976

Board Regular
Joined
Feb 11, 2019
Messages
194
Office Version
  1. 365
Platform
  1. Windows
Good Morning,
I am looking for a macro that will find the last column in my worksheet(SCAN) where Row 1 is populated, select the entire column,
copy, and paste special(VALUES) to column A in worksheet(SHIFT).

Thank You,
B
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Try this:

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
 
Upvote 0
Try this:

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
Wondering how I would edit this macro to retrieve the 2nd to last column? I need to paste special to H1 so I'll change that part to H1
 
Upvote 0
I would edit this macro to retrieve the 2nd to last column?

Try this:
VBA Code:
Sub copypastevalues()
  Sheets("SCAN").Range("B1", Sheets("SCAN").Cells(1, Columns.Count).End(1)).EntireColumn.Copy
  Sheets("SHIFT").Range("H1").PasteSpecial xlPasteValues
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,215,372
Messages
6,124,531
Members
449,169
Latest member
mm424

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