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 to move down cells...

Hi,

On a worksheet it is easy to move down with the cursorkeys of a keyboard,
even if the information in the worksheet is shown using filters. With the
down-arrow-key you go to the next row

With VBA moving to the next cell is easely done with
ActiveCell.OffSet(1,0).Select.

But which VBA-command do you use when your data is display with the use of a
filter? Using ActiveCell.OffSet(1,0).Select results in going to a cell/row
that isn't shown by the flter..

Who can help me?

Thanks,

André



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to move down cells...

I would just do it in a loop, checking to see if the row was visible after each
move.

do
activecell.offset(1,0).select
if activecell.entirerow.hidden = false then
exit do 'found a visible cell
end if
loop

AvWG wrote:

Hi,

On a worksheet it is easy to move down with the cursorkeys of a keyboard,
even if the information in the worksheet is shown using filters. With the
down-arrow-key you go to the next row

With VBA moving to the next cell is easely done with
ActiveCell.OffSet(1,0).Select.

But which VBA-command do you use when your data is display with the use of a
filter? Using ActiveCell.OffSet(1,0).Select results in going to a cell/row
that isn't shown by the flter..

Who can help me?

Thanks,

André


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to move down cells...

Hi Dave,

Just what I was looking for, fantastic!!!

You saved my day!

Thanks,

André from Holland

"Dave Peterson" schreef in bericht
...
I would just do it in a loop, checking to see if the row was visible after
each
move.

do
activecell.offset(1,0).select
if activecell.entirerow.hidden = false then
exit do 'found a visible cell
end if
loop

AvWG wrote:

Hi,

On a worksheet it is easy to move down with the cursorkeys of a keyboard,
even if the information in the worksheet is shown using filters. With the
down-arrow-key you go to the next row

With VBA moving to the next cell is easely done with
ActiveCell.OffSet(1,0).Select.

But which VBA-command do you use when your data is display with the use
of a
filter? Using ActiveCell.OffSet(1,0).Select results in going to a
cell/row
that isn't shown by the flter..

Who can help me?

Thanks,

André


--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default How to move down cells...

Hi,

I posted a similar answer to this which I noted is a messy solution. The
problem with it is you won't know when you come out of the filtered rsngr
into an unfiltered area and could end up processing lines that you don't
intend to or want to.

Mike

"AvWG" wrote:

Hi Dave,

Just what I was looking for, fantastic!!!

You saved my day!

Thanks,

André from Holland

"Dave Peterson" schreef in bericht
...
I would just do it in a loop, checking to see if the row was visible after
each
move.

do
activecell.offset(1,0).select
if activecell.entirerow.hidden = false then
exit do 'found a visible cell
end if
loop

AvWG wrote:

Hi,

On a worksheet it is easy to move down with the cursorkeys of a keyboard,
even if the information in the worksheet is shown using filters. With the
down-arrow-key you go to the next row

With VBA moving to the next cell is easely done with
ActiveCell.OffSet(1,0).Select.

But which VBA-command do you use when your data is display with the use
of a
filter? Using ActiveCell.OffSet(1,0).Select results in going to a
cell/row
that isn't shown by the flter..

Who can help me?

Thanks,

André


--

Dave Peterson



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to move down cells...

You could check:

do
activecell.offset(1,0).select

if activecell.entirerow.hidden = false then
exit do 'found a visible cell
end if

loop

if intersect(activecell, activesheet.filter.range) is nothing then
msgbox "out of the filtered range"
end if



Mike H wrote:

Hi,

I posted a similar answer to this which I noted is a messy solution. The
problem with it is you won't know when you come out of the filtered rsngr
into an unfiltered area and could end up processing lines that you don't
intend to or want to.

Mike

"AvWG" wrote:

Hi Dave,

Just what I was looking for, fantastic!!!

You saved my day!

Thanks,

André from Holland

"Dave Peterson" schreef in bericht
...
I would just do it in a loop, checking to see if the row was visible after
each
move.

do
activecell.offset(1,0).select
if activecell.entirerow.hidden = false then
exit do 'found a visible cell
end if
loop

AvWG wrote:

Hi,

On a worksheet it is easy to move down with the cursorkeys of a keyboard,
even if the information in the worksheet is shown using filters. With the
down-arrow-key you go to the next row

With VBA moving to the next cell is easely done with
ActiveCell.OffSet(1,0).Select.

But which VBA-command do you use when your data is display with the use
of a
filter? Using ActiveCell.OffSet(1,0).Select results in going to a
cell/row
that isn't shown by the flter..

Who can help me?

Thanks,

André

--

Dave Peterson



.


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default How to move down cells...

Hi,

It almost certainly isn't necessary to select to do what you want but this
loops through the visible rows of a filtered column (Col A in this case)
selects the row and a message box gives the address

Sub Loop_Visible()
Dim C As Range, MyRange As Range
Dim VisRange As Range
Set MyRange = ActiveSheet.AutoFilter.Range.Columns(1)
Set MyRange = MyRange.Offset(1, 0).Resize(MyRange.Rows.Count - 1, 1)
Set VisRange = MyRange.SpecialCells(xlVisible)
For Each C In VisRange
'do things
C.Select 'probably not necessary
MsgBox C.Address
Next
End Sub

Mike

"AvWG" wrote:

Hi,

On a worksheet it is easy to move down with the cursorkeys of a keyboard,
even if the information in the worksheet is shown using filters. With the
down-arrow-key you go to the next row

With VBA moving to the next cell is easely done with
ActiveCell.OffSet(1,0).Select.

But which VBA-command do you use when your data is display with the use of a
filter? Using ActiveCell.OffSet(1,0).Select results in going to a cell/row
that isn't shown by the flter..

Who can help me?

Thanks,

André



.

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
Move cells down GARY Excel Discussion (Misc queries) 4 June 10th 11 02:59 PM
Sum At Top And Move Cells Down in VBA Jbm Excel Programming 3 July 27th 09 10:17 PM
Can references (to cells being sorted) move with the cells? Zack Setting up and Configuration of Excel 1 January 16th 08 01:50 PM
Sorting cells: a list behind the cells do not move with the cell Ross M Excel Discussion (Misc queries) 2 September 21st 06 12:14 PM
Move cells Wild Bill[_2_] Excel Programming 0 August 27th 03 11:46 AM


All times are GMT +1. The time now is 01:14 AM.

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"