Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Move cells down | Excel Discussion (Misc queries) | |||
Sum At Top And Move Cells Down in VBA | Excel Programming | |||
Can references (to cells being sorted) move with the cells? | Setting up and Configuration of Excel | |||
Sorting cells: a list behind the cells do not move with the cell | Excel Discussion (Misc queries) | |||
Move cells | Excel Programming |