Next Empty Column

yorkbay

New Member
Joined
Feb 7, 2021
Messages
16
Office Version
  1. 2013
Platform
  1. Windows
I know this should be simple but I'm new to this and not understanding how to reference properly. I'm trying to take my range F1:F121 and copy it to the next empty column. My code is pushing it to the end of all columns that have data but there is a blank column in that range that is where I want it to move. Here is my code:

Range("F1:F121").Copy
Cells(1, Columns.Count).End(xlToLeft).Offset(0, 1).PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
Range("F1:F120").ClearContents

Columns G is used, column H is empty, columns I, J, K etc have data. I want my copied range to paste to the next empty column to the right of F which would be H. Can someone please assist and explain so I can learn how to read the code? Thank you in advance.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Zot

Well-known Member
Joined
Nov 26, 2020
Messages
1,151
Office Version
  1. 2016
Platform
  1. Windows
You can just use xlToRight from Range("F1") then to get to nest empty column, like

ActiveSheet.Range("F1:F121").Copy ActiveSheet.Cells(1, ActiveSheet.Range("F1").End(xlToRight).Column + 1)
 

Watch MrExcel Video

Forum statistics

Threads
1,129,527
Messages
5,636,834
Members
416,945
Latest member
Himu

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
Top