END, SHIFT+ENTER in VBA

JZonneveld

New Member
Joined
Nov 25, 2016
Messages
3
Hi, I am new to VBA and these forums but since every question I put in Google directed me here I figured I'd just make my own account.

I can't find a way to use the END, SHIFT+ENTER function from VBA. This is important because the file contains empty cells and the amount of colums varies per file. The title row is always complete so this function is perfect when used manually. I can't get it to work in VBA though.

When I record a macro, VBA will just specify the range.

Can somebody help me with VBA code that does the same thing?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hi. So you want to find the number of used columns in Row 1 for example? Have I read that right?

Code:
lc = Cells(1, Columns.Count).End(xlToLeft).Column
 
Upvote 0
Thanks for your reply. Its not exactly what I am looking for though. I want VBA to select the entire row of data. (which has empty cells) The first row is complete so with the END, SHIFT+ENTER function I can select the other rows entirely.

This function doens't get recorded in the macro though . It just specifies the range I ended up with. I want to be able to do the same thing within VBA.
 
Upvote 0
This should be a better method than using end. It assumes row 1 is the header row:

Code:
lc = Cells(1, Columns.Count).End(xlToLeft).Column
Range(ActiveCell, Cells(ActiveCell.Row, lc)).Select
 
Upvote 0

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

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