Refer to last non-empty cell in a row

Hermac

New Member
Joined
Sep 5, 2016
Messages
32
Office Version
  1. 365
Platform
  1. Windows
Hello,
I'm looking for the fastest VBA reference for the range [H1:X1], whith [X1] being the varying bat furthest non-empty cell to the right of row 1.
I know it's a rather banal question but I can't get it done.
Can anyone give me a hand.
Thanks a lot!
Herman
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
I don't understand what you need, could you explain it with examples.
 
Upvote 0
If the cells to the right of X1 are truly empty then maybe try...
VBA Code:
Range("H1", Cells(1, Columns.Count).End(xlToLeft)).Select
The .Select is just for demo purposes
 
Upvote 0
Solution

Forum statistics

Threads
1,226,113
Messages
6,189,046
Members
453,522
Latest member
Seeker2025

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