Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel-Center on cell view

Status
Not open for further replies.

wwgmr

MIS
Mar 12, 2001
174
US
Hi, this should be easy Just can't find it in search or in my books.

I have simple button that shows or hides a range. The problem I am having is I want to have it setfocus on the first cell in that range when it unhides it. I tried range(BF5).Select or activate but it doesn't set the view there till I use arrow key or something.

I thought there was .setfocus action but that seems to be only for Textboxes.

Thanks for help.
 
Try:

Range("myRangeName").Cells(1, 1).Select


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Hi
Just to expand John's code a little this will make the first cell the top left cell in the window

With Range("rng").Cells(1, 1)
.Select
ActiveWindow.ScrollColumn = .Column
ActiveWindow.ScrollRow = .Row
End With


Happy Friday
;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
The faqs ma'am, just the faqs. Get the best from these forums : faq222-2244
 
Just in case you don't have a named range:
Code:
With Range([COLOR=green yellow]"BF5:BF25"[/color])
    .Select
    .Cells(1, 1).Activate [COLOR=green] ' to "be sure" 1st cell is activated[/color]
    ActiveWindow.ScrollColumn = .Column
    ActiveWindow.ScrollRow = .Row
End With



Peace!! [americanflag] [peace] [americanflag]

Mike

Didn't get the answers that you wanted? Take a look at FAQ219-2884
 
Hey thanks guys wanted to reply back sooner but found out closing my site :( oh well. So the projects I was trying to add this into are not needed.

Then again this is code I been trying to do for while so it will help in future ! Thanks again everyone.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top