PC Review


Reply
Thread Tools Rate Thread

cell top of screen

 
 
ranswert
Guest
Posts: n/a
 
      9th Feb 2008
Is there a way when a cell is selected in a procedure when the procedure is
done that cell is in the top left portion of the screen?
Thanks
 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      9th Feb 2008
Sub demo()
Set r = Range("Z100")
Application.Goto r, scroll:=True
End Sub
--
Gary''s Student - gsnu200768


"ranswert" wrote:

> Is there a way when a cell is selected in a procedure when the procedure is
> done that cell is in the top left portion of the screen?
> Thanks

 
Reply With Quote
 
Andy Pope
Guest
Posts: n/a
 
      9th Feb 2008
Hi,

Replace example references with desired cell.

Application.Goto Reference:=Worksheets("Sheet1").Range("A154"), _
Scroll:=True

Cheers
Andy

ranswert wrote:
> Is there a way when a cell is selected in a procedure when the procedure is
> done that cell is in the top left portion of the screen?
> Thanks


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
 
Reply With Quote
 
ranswert
Guest
Posts: n/a
 
      9th Feb 2008
I tried your example with the following changes:

set ycell = range(costid)
Application.Goto ycell, Scroll:=True

costid is a named cell in my worksheet

when i try to run this I get an error

What am I doing wrong?
Thanks

"Gary''s Student" wrote:

> Sub demo()
> Set r = Range("Z100")
> Application.Goto r, scroll:=True
> End Sub
> --
> Gary''s Student - gsnu200768
>
>
> "ranswert" wrote:
>
> > Is there a way when a cell is selected in a procedure when the procedure is
> > done that cell is in the top left portion of the screen?
> > Thanks

 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      9th Feb 2008
set ycell = range("costid")

otherwise Excel thinks you are using a variable called costid.
--
Gary''s Student - gsnu200768
 
Reply With Quote
 
ranswert
Guest
Posts: n/a
 
      9th Feb 2008
I am using costid

'dim costid as string" is how I declare it.

"Gary''s Student" wrote:

> set ycell = range("costid")
>
> otherwise Excel thinks you are using a variable called costid.
> --
> Gary''s Student - gsnu200768

 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      9th Feb 2008
Sub demo()
Dim costid As String
costid = "costid"
Set ycell = Range(costid)
Application.Goto ycell, scroll:=True
End Sub

This assumes that you have Defined the Name in the worksheet.

--
Gary''s Student - gsnu200768
 
Reply With Quote
 
ranswert
Guest
Posts: n/a
 
      9th Feb 2008
costid is a variable string that changes depending which cell I want to
reference. costid is set to = "cst01 or cst02 or csto3, etc." depending on
which cell I want to select.
"cst__" are all defined names in a worksheet. I think that I am doing
something wrong with the reference to those cells.

"Gary''s Student" wrote:

> Sub demo()
> Dim costid As String
> costid = "costid"
> Set ycell = Range(costid)
> Application.Goto ycell, scroll:=True
> End Sub
>
> This assumes that you have Defined the Name in the worksheet.
>
> --
> Gary''s Student - gsnu200768

 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      9th Feb 2008
We are nearly there. If, in the worksheet, we assign the Name costid to Z100
or AB10 or any other cell address, the code will work.

The key issue is that in VBA we can use "costid" just like "A1". The
meaning of "costid" is defined in the worksheet and can change to any cell
address you desire.
--
Gary''s Student - gsnu200768
 
Reply With Quote
 
ranswert
Guest
Posts: n/a
 
      9th Feb 2008
I'm sorry I'm not explaining it well. The actual defined name for the cells
are cst01,cst02,etc. I have written a code where costid is a variable that
gets assigned a value of cst01 or cst02 or etc. Then I set ycell =
range(costid) , which I think is setting ycell = range("cst01") or what ever
cst__ is identified. Then I am trying to put that cell in the top left
corner of the screen. I hope that that all makes sense.


"Gary''s Student" wrote:

> We are nearly there. If, in the worksheet, we assign the Name costid to Z100
> or AB10 or any other cell address, the code will work.
>
> The key issue is that in VBA we can use "costid" just like "A1". The
> meaning of "costid" is defined in the worksheet and can change to any cell
> address you desire.
> --
> Gary''s Student - gsnu200768

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Arrow keys move screen instead of moving from cell to cell LuisGe Microsoft Excel Misc 5 22nd May 2009 11:17 PM
How do I get cell possition in screen x y =?Utf-8?B?SGFsaW0=?= Microsoft Excel Programming 5 12th Jul 2006 11:26 AM
Arrow keys move screen instead of moving from cell to cell. =?Utf-8?B?SmFKYXk3Nzc=?= Microsoft Excel Setup 1 17th Jan 2005 06:48 PM
Getting HyperLinked Cell to Appear at the Top of the Screen John Tjia Microsoft Excel Programming 4 6th Feb 2004 07:19 PM
Screen Coordinates of a given cell in XL hglamy Microsoft Excel Programming 2 15th Oct 2003 02:03 PM


Features
 

Advertising
 

Newsgroups
 


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