Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default How to make the first cell in autofiltered list the activecell?


Hi,

I have a list of data that I autofilter to show only one row. From this row
I want to assign data to variables with the attached code.

My problem is that the active cell is never in my autofiltered list and I do
not seem to be able to get it there. How do I get a fix reference (such as
the active cell) on the only visible row in a fixed column?

Please help,
Peter

Selection.AutoFilter Field:=3, Criteria1:=myReqRev

' How do I change the activecell to be on the only and/or first visible row?

With ActiveCell
myReqSourceID = .Offset(0, 0).Value
myReqText = .Offset(0, 1).Value
myValue = .Offset(0, 2).Value
myUnit = .Offset(0, 3).Value


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default How to make the first cell in autofiltered list the activecell?

Now I have tested a solution that works, but it is not a nice solution:

Improvement suggestions are still very welcome.

Peter


Selection.AutoFilter Field:=3, Criteria1:=myReqRev

Range("ReqID").Select
Do
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell.EntireRow.Hidden = False

With ActiveCell
myReqSourceID = .Offset(0, 7).Value
myReqText = .Offset(0, 8).Value
myValue = .Offset(0, 9).Value

"Peters" wrote:


Hi,

I have a list of data that I autofilter to show only one row. From this row
I want to assign data to variables with the attached code.

My problem is that the active cell is never in my autofiltered list and I do
not seem to be able to get it there. How do I get a fix reference (such as
the active cell) on the only visible row in a fixed column?

Please help,
Peter

Selection.AutoFilter Field:=3, Criteria1:=myReqRev

' How do I change the activecell to be on the only and/or first visible row?

With ActiveCell
myReqSourceID = .Offset(0, 0).Value
myReqText = .Offset(0, 1).Value
myValue = .Offset(0, 2).Value
myUnit = .Offset(0, 3).Value


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default How to make the first cell in autofiltered list the activecell?


If you are using a "later" version of Excel?...
(http://www.cpearson.com/excel/newposte.htm)

The following identifies the range that is visible on the screen.
(the non-filtered range)
It is shown in steps to make it a little clearer.

Sub FindTheVisibleRange()
Dim rng As Range
Set rng = ActiveSheet.AutoFilter.Range
'Exclude header row
Set rng = rng.Offset(1, 0).Resize(rng.Rows.Count - 1)
'Get the visible cells
Set rng = rng.SpecialCells(xlCellTypeVisible)
MsgBox rng.Address
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"Peters"

wrote in message
Now I have tested a solution that works, but it is not a nice solution:
Improvement suggestions are still very welcome.
Peter
Selection.AutoFilter Field:=3, Criteria1:=myReqRev
Range("ReqID").Select
Do
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell.EntireRow.Hidden = False
With ActiveCell
myReqSourceID = .Offset(0, 7).Value
myReqText = .Offset(0, 8).Value
myValue = .Offset(0, 9).Value



"Peters" wrote:
Hi,
I have a list of data that I autofilter to show only one row. From this row
I want to assign data to variables with the attached code.
My problem is that the active cell is never in my autofiltered list and I do
not seem to be able to get it there. How do I get a fix reference (such as
the active cell) on the only visible row in a fixed column?
Please help,
Peter
Selection.AutoFilter Field:=3, Criteria1:=myReqRev
' How do I change the activecell to be on the only and/or first visible row?
With ActiveCell
myReqSourceID = .Offset(0, 0).Value
myReqText = .Offset(0, 1).Value
myValue = .Offset(0, 2).Value
myUnit = .Offset(0, 3).Value

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default How to make the first cell in autofiltered list the activecell

Hello Jim,

Thanks for the advice. I have tried something similar but could not get it
working. I will try again with this version! :-)

Regards,
Peter S


"Jim Cone" wrote:


If you are using a "later" version of Excel?...
(http://www.cpearson.com/excel/newposte.htm)

The following identifies the range that is visible on the screen.
(the non-filtered range)
It is shown in steps to make it a little clearer.

Sub FindTheVisibleRange()
Dim rng As Range
Set rng = ActiveSheet.AutoFilter.Range
'Exclude header row
Set rng = rng.Offset(1, 0).Resize(rng.Rows.Count - 1)
'Get the visible cells
Set rng = rng.SpecialCells(xlCellTypeVisible)
MsgBox rng.Address
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"Peters"

wrote in message
Now I have tested a solution that works, but it is not a nice solution:
Improvement suggestions are still very welcome.
Peter
Selection.AutoFilter Field:=3, Criteria1:=myReqRev
Range("ReqID").Select
Do
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell.EntireRow.Hidden = False
With ActiveCell
myReqSourceID = .Offset(0, 7).Value
myReqText = .Offset(0, 8).Value
myValue = .Offset(0, 9).Value



"Peters" wrote:
Hi,
I have a list of data that I autofilter to show only one row. From this row
I want to assign data to variables with the attached code.
My problem is that the active cell is never in my autofiltered list and I do
not seem to be able to get it there. How do I get a fix reference (such as
the active cell) on the only visible row in a fixed column?
Please help,
Peter
Selection.AutoFilter Field:=3, Criteria1:=myReqRev
' How do I change the activecell to be on the only and/or first visible row?
With ActiveCell
myReqSourceID = .Offset(0, 0).Value
myReqText = .Offset(0, 1).Value
myValue = .Offset(0, 2).Value
myUnit = .Offset(0, 3).Value


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
How to make last cell in current selection the activecell Snowsride Excel Programming 1 September 5th 06 02:30 PM
Make last cell in currentregion the activecell Snowsride Excel Programming 3 September 5th 06 07:01 AM
Copying to an autofiltered list Phil Excel Discussion (Misc queries) 3 June 30th 05 02:08 PM
Stepping through an autofiltered list Stefi Excel Programming 2 May 25th 05 01:41 PM
Filling An Autofiltered List Neil Excel Programming 1 August 3rd 04 01:46 AM


All times are GMT +1. The time now is 02:15 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"