ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Moving left/right from active cell (https://www.excelbanter.com/excel-programming/349491-moving-left-right-active-cell.html)

Kurt Barr[_2_]

Moving left/right from active cell
 
I have a piece of code that I am using to find the first blank cell in a
range. I want to be able to then go over a specific number of columns from
that blank cell to paste a formula in it. Is there a macro that I can use to
do that?

Jim Thomlinson[_5_]

Moving left/right from active cell
 
Without any code posted I will just assume that you are using the active
cell. If that is the case then

Activecell.offset(0, 2) 'two columns to the right...

if you are using range objects then you can just offset your range object in
a similar manner with a set statement...
--
HTH...

Jim Thomlinson


"Kurt Barr" wrote:

I have a piece of code that I am using to find the first blank cell in a
range. I want to be able to then go over a specific number of columns from
that blank cell to paste a formula in it. Is there a macro that I can use to
do that?


Chip Pearson

Moving left/right from active cell
 
You can use the Offset property of the Range object. E.g.,

Dim Rng As Range
Dim Rng2 As Range
Set Rng = Range("A1") ' or whatever
Set Rng2 = Rng.Offset(0,3) ' 3 cols to the right


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Kurt Barr" <Kurt wrote in
message
...
I have a piece of code that I am using to find the first blank
cell in a
range. I want to be able to then go over a specific number of
columns from
that blank cell to paste a formula in it. Is there a macro that
I can use to
do that?




Kurt Barr

Moving left/right from active cell
 
That worked perfectly. Thank you very much!

"Jim Thomlinson" wrote:

Without any code posted I will just assume that you are using the active
cell. If that is the case then

Activecell.offset(0, 2) 'two columns to the right...

if you are using range objects then you can just offset your range object in
a similar manner with a set statement...
--
HTH...

Jim Thomlinson


"Kurt Barr" wrote:

I have a piece of code that I am using to find the first blank cell in a
range. I want to be able to then go over a specific number of columns from
that blank cell to paste a formula in it. Is there a macro that I can use to
do that?



All times are GMT +1. The time now is 02:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com