Next Empty Column

mikebecker

Board Regular
Joined
Mar 28, 2004
Messages
227
I have data in column A. I need to go to the next empty column to paste data from another workbook. I am having difficulties. Also, I was able to get code to work if there already data in column B, C, ... but if the workbook is new and no data in column B, my code finds the first empty column to the extreme right of the workbook.

This is what I've tried so far..

<font face=Courier New>    <SPAN style="color:#007F00">'This command goes to the extreme right of the worksheet</SPAN>
    Selection.End(xlToRight).Select
    ActiveCell.Offset(0, 1).Range("A1").Select
    
    <SPAN style="color:#007F00">'This command goes to A2 - even with data.</SPAN>
    ActiveCell.Offset(0, 1).Range("A1").Select
</FONT>

Regards,

Mike
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Oaktree

MrExcel MVP
Joined
Jun 20, 2002
Messages
8,105
Office Version
  1. 365
Perhaps this?

'This command goes to the extreme right of the worksheet
Range("A1").End(xlToRight).Offset(0, 1).Select

'This command goes to A2 - even with data.
Range("A1").offset(1,0).select
 

Forum statistics

Threads
1,181,825
Messages
5,932,278
Members
436,832
Latest member
joro613

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