ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Go To a Named Range (2nd posting) (https://www.excelbanter.com/excel-worksheet-functions/448256-go-named-range-2nd-posting.html)

[email protected]

Go To a Named Range (2nd posting)
 
I posted my question about three weeks ago. I have several views but nobody informed me if it is possible or not.

I have several named ranges in my worksheet. If I go to one, is it possible that when it goes to that named range, the named range will be positioned at the upper left part of the worksheet (in a blank worksheet the named range would be at A1).

Thanks

GS[_2_]

Go To a Named Range (2nd posting)
 
It happens that formulated :
I posted my question about three weeks ago. I have several views but nobody
informed me if it is possible or not.

I have several named ranges in my worksheet. If I go to one, is it possible
that when it goes to that named range, the named range will be positioned at
the upper left part of the worksheet (in a blank worksheet the named range
would be at A1).

Thanks


Application.Goto Range("RangeName"), Scroll:=True

--
Garry

Free usenet access at
http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



Gizzmo

Quote:

Originally Posted by (Post 1609730)
I posted my question about three weeks ago. I have several views but nobody informed me if it is possible or not.

I have several named ranges in my worksheet. If I go to one, is it possible that when it goes to that named range, the named range will be positioned at the upper left part of the worksheet (in a blank worksheet the named range would be at A1).

Thanks

Sorry but post is unclear. What are you trying to do? Are you trying to record what named range was selected in cell A1 of a blank spreadhseet was once you have gone to the named range?

CellShocked

Go To a Named Range (2nd posting)
 
On Sun, 24 Feb 2013 19:02:34 -0500, GS wrote:

It happens that formulated :
I posted my question about three weeks ago. I have several views but nobody
informed me if it is possible or not.

I have several named ranges in my worksheet. If I go to one, is it possible
that when it goes to that named range, the named range will be positioned at
the upper left part of the worksheet (in a blank worksheet the named range
would be at A1).

Thanks


Application.Goto Range("RangeName"), Scroll:=True



My script moves to the sheet first, in case it is not the current...

Sheets("Sheetname").Select
Range("RangeName").Select

Those are for single cell assignments, however. I do not know how a
table would respond. It likely highlights the whole named range.
But I do not know.

[email protected]

Go To a Named Range (2nd posting)
 
On Sunday, February 24, 2013 11:11:21 AM UTC-8, wrote:
I posted my question about three weeks ago. I have several views but nobody informed me if it is possible or not.



I have several named ranges in my worksheet. If I go to one, is it possible that when it goes to that named range, the named range will be positioned at the upper left part of the worksheet (in a blank worksheet the named range would be at A1).



Thanks


Maybe this modified code by Chip Pearson will do the trick for you.
I entered all the names of my named ranges in a data valadation
drop down in F1.

Select a name from F1 and run the Sub LHK().

Option Explicit
Sub LHK()
Dim i As String
i = Range("F1").Value
CenterOnCell Range(i)
End Sub

Sub CenterOnCell(OnCell As Range)

Dim VisRows As Integer
Dim VisCols As Integer

Application.ScreenUpdating = False

OnCell.Parent.Parent.Activate
OnCell.Parent.Activate

With ActiveWindow.VisibleRange
VisRows = .Rows.Count
VisCols = .Columns.Count
End With

Application.Goto OnCell, Scroll:=True
OnCell.Select
Application.ScreenUpdating = True

End Sub

Regards,
Howard

[email protected]

Go To a Named Range (2nd posting)
 
On Monday, February 25, 2013 8:32:46 AM UTC-8, wrote:
On Sunday, February 24, 2013 11:11:21 AM UTC-8, wrote:

I posted my question about three weeks ago. I have several views but nobody informed me if it is possible or not.








I have several named ranges in my worksheet. If I go to one, is it possible that when it goes to that named range, the named range will be positioned at the upper left part of the worksheet (in a blank worksheet the named range would be at A1).








Thanks




Maybe this modified code by Chip Pearson will do the trick for you.

I entered all the names of my named ranges in a data valadation

drop down in F1.



Select a name from F1 and run the Sub LHK().



Option Explicit

Sub LHK()

Dim i As String

i = Range("F1").Value

CenterOnCell Range(i)

End Sub



Sub CenterOnCell(OnCell As Range)



Dim VisRows As Integer

Dim VisCols As Integer



Application.ScreenUpdating = False



OnCell.Parent.Parent.Activate

OnCell.Parent.Activate



With ActiveWindow.VisibleRange

VisRows = .Rows.Count

VisCols = .Columns.Count

End With



Application.Goto OnCell, Scroll:=True

OnCell.Select

Application.ScreenUpdating = True



End Sub



Regards,

Howard


Thanks Howard and to everybody that replied. I thought that were was an easier way to do it instead of a macro. When I go to a range, I'll just scroll down to it.

Thanks again



All times are GMT +1. The time now is 06:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com