Next Empty Column

yorkbay

New Member
Joined
Feb 7, 2021
Messages
18
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

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
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)
 
Upvote 0

Forum statistics

Threads
1,214,892
Messages
6,122,112
Members
449,066
Latest member
Andyg666

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