Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How do I simulate a cursor down in Excel Macros

I don't want to selec the next cell down, I want simulate a cursor
down.

For example, if I have data grouped or hidden rows, when I do a cursor
down i don;t want it ogo to the current row + 1, I want it to go to the
next visible row which might be current row +Y.

Hitting cursor down does this but how do I make that happein in a macro

Thanks

Steve

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default How do I simulate a cursor down in Excel Macros

Sub YSelect ()
Range("Y1").Select
End Sub
Assign this to a button or picture

Now this is what you asked for, but I don't think it's what you want
You may want a worksheet event, lets see how the ball rolls today with
other replies

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default How do I simulate a cursor down in Excel Macros

This will select the next cell down from current row which is not hidden.
If checks just in case you are on last row of worksheet!

Sub NextVisibleRow1()
Dim xr As Long
xr = ActiveCell.Row + 1
If xr <= Rows.Count Then
Do While Rows(xr).EntireRow.Hidden = True
xr = xr + 1
Loop
Cells(xr, ActiveCell.Column).Select
End If
End Sub

--
Cheers
Nigel



wrote in message
oups.com...
I don't want to selec the next cell down, I want simulate a cursor
down.

For example, if I have data grouped or hidden rows, when I do a cursor
down i don;t want it ogo to the current row + 1, I want it to go to the
next visible row which might be current row +Y.

Hitting cursor down does this but how do I make that happein in a macro

Thanks

Steve



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How do I simulate a cursor down in Excel Macros

Yeah, I thought about putting it in a loop and checking the hidden
property but I thought, surely, there must be a CursorDown function
that would achieve the same thing and do all necessary checking for
more rows etc. etc.

Does anyone know if there is, or does anyone know if there definately
isn't!

Thanks for the replies.

Steve

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do I simulate a cursor down in Excel Macros

ActiveCell.End(xldown)

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Yeah, I thought about putting it in a loop and checking the hidden
property but I thought, surely, there must be a CursorDown function
that would achieve the same thing and do all necessary checking for
more rows etc. etc.

Does anyone know if there is, or does anyone know if there definately
isn't!

Thanks for the replies.

Steve





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default How do I simulate a cursor down in Excel Macros

Tom Ogilvy has already posted a response to your specific question.
You can discover the same yourself with the XL macro recorder (Tools |
Macro Record new macro...)

Also, notice Tom simply used End(xlDown) without any follow up
'Select'. There is rarely a need to actually activate/select an XL
object. For an intro see
Beyond Excel's recorder
http://www.tushar-
mehta.com/excel/vba/beyond_the_macro_recorder/index.htm

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article .com,
says...
I don't want to selec the next cell down, I want simulate a cursor
down.

For example, if I have data grouped or hidden rows, when I do a cursor
down i don;t want it ogo to the current row + 1, I want it to go to the
next visible row which might be current row +Y.

Hitting cursor down does this but how do I make that happein in a macro

Thanks

Steve


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default How do I simulate a cursor down in Excel Macros

Tom,

Does not that take you to the last row in the region ? The OP wanted the
cell of the next un-hidden row.

--
Cheers
Nigel



"Tom Ogilvy" wrote in message
...
ActiveCell.End(xldown)

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Yeah, I thought about putting it in a loop and checking the hidden
property but I thought, surely, there must be a CursorDown function
that would achieve the same thing and do all necessary checking for
more rows etc. etc.

Does anyone know if there is, or does anyone know if there definately
isn't!

Thanks for the replies.

Steve





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do I simulate a cursor down in Excel Macros

I was interpreting the cursordown as end, then down arrow, but I see your
point - he probably wants just a down arrow. I think he would need sendkeys
for that.

or something like

set rng = ActiveCell.offset(1).Resize(1000).SpecialCells(xlV isible)
rng(1).Select

The 1000 being somewhat arbitrary

--
Regards,
Tom Ogilvy


"Nigel" wrote in message
...
Tom,

Does not that take you to the last row in the region ? The OP wanted the
cell of the next un-hidden row.

--
Cheers
Nigel



"Tom Ogilvy" wrote in message
...
ActiveCell.End(xldown)

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Yeah, I thought about putting it in a loop and checking the hidden
property but I thought, surely, there must be a CursorDown function
that would achieve the same thing and do all necessary checking for
more rows etc. etc.

Does anyone know if there is, or does anyone know if there definately
isn't!

Thanks for the replies.

Steve







  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do I simulate a cursor down in Excel Macros

Or a bit better:

Sub EFG()
Dim rng As Range
Set rng = Range(ActiveCell.Offset(1), _
ActiveCell.Offset(1).End(xlDown)) _
.SpecialCells(xlVisible)
rng(1).Select
End Sub

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
I was interpreting the cursordown as end, then down arrow, but I see your
point - he probably wants just a down arrow. I think he would need

sendkeys
for that.

or something like

set rng = ActiveCell.offset(1).Resize(1000).SpecialCells(xlV isible)
rng(1).Select

The 1000 being somewhat arbitrary

--
Regards,
Tom Ogilvy


"Nigel" wrote in message
...
Tom,

Does not that take you to the last row in the region ? The OP wanted

the
cell of the next un-hidden row.

--
Cheers
Nigel



"Tom Ogilvy" wrote in message
...
ActiveCell.End(xldown)

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Yeah, I thought about putting it in a loop and checking the hidden
property but I thought, surely, there must be a CursorDown function
that would achieve the same thing and do all necessary checking for
more rows etc. etc.

Does anyone know if there is, or does anyone know if there

definately
isn't!

Thanks for the replies.

Steve









  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default How do I simulate a cursor down in Excel Macros

Very neat !!

--
Cheers
Nigel



"Tom Ogilvy" wrote in message
...
Or a bit better:

Sub EFG()
Dim rng As Range
Set rng = Range(ActiveCell.Offset(1), _
ActiveCell.Offset(1).End(xlDown)) _
.SpecialCells(xlVisible)
rng(1).Select
End Sub

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
I was interpreting the cursordown as end, then down arrow, but I see

your
point - he probably wants just a down arrow. I think he would need

sendkeys
for that.

or something like

set rng = ActiveCell.offset(1).Resize(1000).SpecialCells(xlV isible)
rng(1).Select

The 1000 being somewhat arbitrary

--
Regards,
Tom Ogilvy


"Nigel" wrote in message
...
Tom,

Does not that take you to the last row in the region ? The OP wanted

the
cell of the next un-hidden row.

--
Cheers
Nigel



"Tom Ogilvy" wrote in message
...
ActiveCell.End(xldown)

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Yeah, I thought about putting it in a loop and checking the hidden
property but I thought, surely, there must be a CursorDown

function
that would achieve the same thing and do all necessary checking

for
more rows etc. etc.

Does anyone know if there is, or does anyone know if there

definately
isn't!

Thanks for the replies.

Steve













  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default How do I simulate a cursor down in Excel Macros

what are you really trying to do?? Obviously your not asking for the
right thing!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simulate Check Box Karen Excel Discussion (Misc queries) 15 April 27th 09 06:34 PM
Can I change the "white cross" cursor in Excel to another cursor? KFEagle Excel Discussion (Misc queries) 1 May 3rd 05 08:01 PM
how do i simulate a king queen or jack playing card in excel assum I'm an excel nut... Excel Discussion (Misc queries) 2 February 12th 05 04:55 PM
EXCEL 2002: How do I user/simulate a Timer event in Excel form JohnF[_2_] Excel Programming 12 September 23rd 04 04:56 PM
EXCEL 2002: How do I user/simulate a Timer event in Excel form John Fejsa Excel Programming 2 August 18th 04 03:44 AM


All times are GMT +1. The time now is 03:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"