ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting Cells (https://www.excelbanter.com/excel-programming/352804-selecting-cells.html)

gabe

Selecting Cells
 
Hey,

I'm trying to select the next cell down, just like you would if you used the
up and down keys on your keyboard. What code could I use?

I tried this already but it doesn't work:

Range("B3").Activate
ActiveCell.Next(x1Down).Select

Any suggestions?

sebastienm

Selecting Cells
 
Hi
Try:
ActiveCell.Offset(1, 0).Select
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gabe" wrote:

Hey,

I'm trying to select the next cell down, just like you would if you used the
up and down keys on your keyboard. What code could I use?

I tried this already but it doesn't work:

Range("B3").Activate
ActiveCell.Next(x1Down).Select

Any suggestions?


gabe

Selecting Cells
 
Alright this is about to get complicated so bear with me,

The reason I need it to do exactely what the arrow keys do is because, I
have grouped cells B4:B9. If I use the arrow keys, excel automatically goes
from B3 to B10. So you see the offset command won't work! Now what!?

"sebastienm" wrote:

Hi
Try:
ActiveCell.Offset(1, 0).Select
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gabe" wrote:

Hey,

I'm trying to select the next cell down, just like you would if you used the
up and down keys on your keyboard. What code could I use?

I tried this already but it doesn't work:

Range("B3").Activate
ActiveCell.Next(x1Down).Select

Any suggestions?


sebastienm

Selecting Cells
 
I see. What about:
Range("B3").Activate
Application.SendKeys "{DOWN}"
Probably not the best to use SendKeys, but depending on what your overall
process is, it could be just working fine.
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gabe" wrote:

Alright this is about to get complicated so bear with me,

The reason I need it to do exactely what the arrow keys do is because, I
have grouped cells B4:B9. If I use the arrow keys, excel automatically goes
from B3 to B10. So you see the offset command won't work! Now what!?

"sebastienm" wrote:

Hi
Try:
ActiveCell.Offset(1, 0).Select
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gabe" wrote:

Hey,

I'm trying to select the next cell down, just like you would if you used the
up and down keys on your keyboard. What code could I use?

I tried this already but it doesn't work:

Range("B3").Activate
ActiveCell.Next(x1Down).Select

Any suggestions?


Gene Mills

Selecting Cells
 
Try selection.offset(1,0).select
or activecell.offset(1,0).select
or range("B1").select
or [b1].select
or .offset(1,0). means 1 cell down
or .offset(0,1). means 1 cell right
or .offset(-1,0). means 1 cell up
or .offset(0,-1). means 1 cell left


"Gabe" wrote in message
...
Hey,

I'm trying to select the next cell down, just like you would if you used
the
up and down keys on your keyboard. What code could I use?

I tried this already but it doesn't work:

Range("B3").Activate
ActiveCell.Next(x1Down).Select

Any suggestions?




gabe

Selecting Cells
 
I copied the example you wrote but it's not working, is there something I
have to change in the example first?

"sebastienm" wrote:

I see. What about:
Range("B3").Activate
Application.SendKeys "{DOWN}"
Probably not the best to use SendKeys, but depending on what your overall
process is, it could be just working fine.
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gabe" wrote:

Alright this is about to get complicated so bear with me,

The reason I need it to do exactely what the arrow keys do is because, I
have grouped cells B4:B9. If I use the arrow keys, excel automatically goes
from B3 to B10. So you see the offset command won't work! Now what!?

"sebastienm" wrote:

Hi
Try:
ActiveCell.Offset(1, 0).Select
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gabe" wrote:

Hey,

I'm trying to select the next cell down, just like you would if you used the
up and down keys on your keyboard. What code could I use?

I tried this already but it doesn't work:

Range("B3").Activate
ActiveCell.Next(x1Down).Select

Any suggestions?


sebastienm

Selecting Cells
 
hmm ... no.
- what is the selected cell before you run the macro
- what is the selected cell after you run the macro (it should ebnd up is B4)
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gabe" wrote:

I copied the example you wrote but it's not working, is there something I
have to change in the example first?

"sebastienm" wrote:

I see. What about:
Range("B3").Activate
Application.SendKeys "{DOWN}"
Probably not the best to use SendKeys, but depending on what your overall
process is, it could be just working fine.
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


gabe

Selecting Cells
 
B3 befroe I run it, B3 after I run it.

"sebastienm" wrote:

hmm ... no.
- what is the selected cell before you run the macro
- what is the selected cell after you run the macro (it should ebnd up is B4)
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gabe" wrote:

I copied the example you wrote but it's not working, is there something I
have to change in the example first?

"sebastienm" wrote:

I see. What about:
Range("B3").Activate
Application.SendKeys "{DOWN}"
Probably not the best to use SendKeys, but depending on what your overall
process is, it could be just working fine.
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


gabe

Selecting Cells
 
Oh I get it!, I had to create a command button in excelassign the
macroclose VBAthen run it from excel. Before I was in VBA jusk clicking the
F8 button through each step. Cool thanks sebastien for your help.

"Gabe" wrote:

B3 befroe I run it, B3 after I run it.

"sebastienm" wrote:

hmm ... no.
- what is the selected cell before you run the macro
- what is the selected cell after you run the macro (it should ebnd up is B4)
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Gabe" wrote:

I copied the example you wrote but it's not working, is there something I
have to change in the example first?

"sebastienm" wrote:

I see. What about:
Range("B3").Activate
Application.SendKeys "{DOWN}"
Probably not the best to use SendKeys, but depending on what your overall
process is, it could be just working fine.
--
Regards,
Sébastien
<http://www.ondemandanalysis.com



All times are GMT +1. The time now is 09:50 AM.

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