Specific row at the top of the screen?

  • Thread starter Thread starter Bobby
  • Start date Start date
B

Bobby

I have been looking in this forum for an answer to help me position a
specific row located by a macro at the top of the screen. Can someone
help?
Thank's ahead
 
From the Excel Vba help file...

This example moves row ten to the top of the window.
Worksheets("Sheet1").Activate
ActiveWindow.ScrollRow = 10
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"Bobby"
wrote in message
I have been looking in this forum for an answer to help me position a
specific row located by a macro at the top of the screen. Can someone
help?
Thank's ahead
 
Try something like this
Dim myOldRange As Range
Dim myNewRange As Range

'
Set myOldRange = ActiveCell
Set myNewRange = Range("a100")
ActiveWindow.SmallScroll Down:=myNewRange.Row - myOldRange.Row
ActiveWindow.SmallScroll toLeft:=myNewRange.Column - myOldRange.Column

I don't think it does what you want YET, but you can play with it.
 
Which "specific" row would you be referring to?

A user-selected row or a row with a particular value?

How would the macro locate the row?

Do you have a macro? Post the code.

Here is a simple macro that copies a selected row or rows to row 1

Sub copy_row()
Selection.Copy Destination:= _
ActiveSheet.Range("A1")
End Sub

No warning, just overwrites.


Gord Dibben MS Excel MVP
 
Which "specific" row would you be referring to?

A user-selected row or a row with a particular value?

How would the macro locate the row?

Do you have a macro?  Post the code.

Here is a simple macro that copies a selected row or rows to row 1

Sub copy_row()
    Selection.Copy Destination:= _
            ActiveSheet.Range("A1")
End Sub

No warning, just overwrites.

Gord Dibben  MS Excel MVP





- Show quoted text -

Hi Gord!
What I do is I locate the current month in a specific column starting
from the top of the file. Whwn I get a hit I would like to put that
specific row on top. Here is the code:

Range("E:E").Select
mois = Split("bidon jan fév mar avr mai jun jul aoû sep oct nov déc",
" ")
findvar = mois(Month(Date))
With ActiveSheet.Range("E:E") ' SUPER SEARCH...!
Set c = .Find(findvar, LookIn:=xlValues)
If c Is Nothing Then Exit Sub 'Pas trouvé!
End With

Range("A" & c.Row & ":" & "A" & c.Row).Select
 
I think maybe I mis-interpreted your needs.

Do you want that row scrolled to the top as Jim has suggested?

He might have interpreted "position" better than I did.

Otherwise, add this line to your code

    Selection.Copy Destination:= _
            ActiveSheet.Range("A1")


Gord
 
I think maybe I mis-interpreted your needs.

Do you want that row scrolled to the top as Jim has suggested?

He might have interpreted "position" better than I did.

Otherwise, add this line to your code

     Selection.Copy Destination:= _
             ActiveSheet.Range("A1")

Gord







- Show quoted text -

Yes, I want that row scrolled to the top.
Thank's for your time.
 
Back
Top