Selection to the Left (plus/minus 1)

default_name

Board Regular
Joined
May 16, 2018
Messages
180
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
I am having a similar struggle as the OP in this thread, except in mine I am trying to go to to the left, minus 1 (or would it be plus 1?). I basically just want to start at FM8 and select all the way left, then move the selection to the right one column.

I recorded the macro to try and get this to work, but it isnt very intuitive at all.

Here's what I have:
VBA Code:
    Range("FM8").Select   'Starts at cell FM8
    Range(Selection, Selection.End(xlToLeft)).Select 'Selects all of the blank cells to the left, until it hits a cell with a value. It selected all the cells from FM8 to the left (in this case it found a value at EF8)
    Range("EG8:FM8").Select 'I want to shift the selection one column to the right (FM8 all the way left to EG8)

I would like it to look something like:
VBA Code:
    Range("FM8").Select   'Starts at cell FM8
    Range(Selection, Selection.End(xlToLeft)).Select-1 'Selects all of the blank cells to the left, until it hits a cell with a value. Then shifts the selection -1 (or would it be +1) so that the cell with the value isnt selected

But that doesnt work.
Thanks in advance for your help!
(apologies for posting this in an older thread)
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
How about
VBA Code:
Range("FM8", Range("FM8").End(xlToLeft).Offset(, 1)).Select
Although there is very rarely any need to select cells
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,123
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