Refer to last non-empty cell in a row

Hermac

New Member
Joined
Sep 5, 2016
Messages
28
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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
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,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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