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

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
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
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,509
Members
448,967
Latest member
screechyboy79

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