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

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Oaktree

MrExcel MVP
Joined
Jun 20, 2002
Messages
8,021
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,147,848
Messages
5,743,525
Members
423,801
Latest member
paulj4177

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