Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default VB Code to return to top of page

I have a user interface where people can go to a number of hidden tabs by
clicking on command buttons.

What the code does is unhide the tab and makes it active but at the bottom,
is another button which will hide the tab and take them back to the first
screen.

The problem I am having is that the user will need to scroll down the screen
to return to the index so if/when they return, the tab opens half way down
the page.

What I want to know is if there is some code that when it makes a tab
active, that it returns to the top of the screen. I have thought about
setting up bookmarks but I have over 20 tabs and frankly cant be bothered lol.

Cheers in advance for your help!

Mav
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default VB Code to return to top of page

Could you not just insert the following in the code that takes you to
the tab:

Range("A1").Select

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default VB Code to return to top of page

copied info from another active thread in the newsgroup regarding
similar circumstances...........
hope it helps!
susan
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hi there, I wonder if it is possible to always keep one piece of

text at the beginning of a cell. Lets say cells in range D5 to
D2000 always need to contain the text "Financial Review: " at the
beginning then followed by the user's entry. If the cell is empty
nothing should be displayed. Cells in range D5 to D2000 are to start
with empty but will be populated with any kind of text as we go
along. The user might enter "Revenue to low according to PL". After
the user has entered "Revenue to low according to PL" is it then
possible to add "Financial Review: " with a macro. The Cell should
now display "Financial Review: Revenue to low according to PL". Any
help much appreciated. -- Regards, Martin - Hide quoted text --
Show quoted text -
More options Apr 19, 7:07 am

Newsgroups: microsoft.public.excel.programming
From: "Norman Jones"
Date: Thu, 19 Apr 2007 12:07:59 +0100
Local: Thurs, Apr 19 2007 7:07 am
Subject: Always keep first part of text in a cell
Reply | Reply to author | Forward | Print | Individual message | Show
original | Report this message | Find messages by this author
Hi Martin,

Try:


'=============
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rng As Range
Dim rCell As Range
Const sStr As String = "Financial Review: "


Set Rng = Me.Range("D5:D2000") '<<==== CHANGE
Set Rng = Intersect(Rng, Target)


If Not Rng Is Nothing Then
On Error GoTo XIT
Application.EnableEvents = False
For Each rCell In Rng.Cells
With rCell
If Not IsEmpty(.Value) Then
.Value = sStr & Replace(.Value, sStr, _
vbNullString, 1, 1, vbTextCompare)
End If
End With
Next rCell


XIT:
Application.EnableEvents = True
End If
End Sub
'<<=============


This is worksheet event code and should be pasted into the
worksheets's code
module (not a standard module and not the workbook's ThisWorkbook
module):


Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
end of pasted material
susan


On Apr 19, 11:02 am, Maver1ck666
wrote:
I have a user interface where people can go to a number of hidden tabs by
clicking on command buttons.

What the code does is unhide the tab and makes it active but at the bottom,
is another button which will hide the tab and take them back to the first
screen.

The problem I am having is that the user will need to scroll down the screen
to return to the index so if/when they return, the tab opens half way down
the page.

What I want to know is if there is some code that when it makes a tab
active, that it returns to the top of the screen. I have thought about
setting up bookmarks but I have over 20 tabs and frankly cant be bothered lol.

Cheers in advance for your help!

Mav



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default VB Code to return to top of page

Use
Application.Goto sheets("Sheet1").Range("A1")

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Maver1ck666" wrote in message ...
I have a user interface where people can go to a number of hidden tabs by
clicking on command buttons.

What the code does is unhide the tab and makes it active but at the bottom,
is another button which will hide the tab and take them back to the first
screen.

The problem I am having is that the user will need to scroll down the screen
to return to the index so if/when they return, the tab opens half way down
the page.

What I want to know is if there is some code that when it makes a tab
active, that it returns to the top of the screen. I have thought about
setting up bookmarks but I have over 20 tabs and frankly cant be bothered lol.

Cheers in advance for your help!

Mav

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default VB Code to return to top of page

Brilliant! Its certainly been a long day. Thanks for the help!

Mav.

" wrote:

Could you not just insert the following in the code that takes you to
the tab:

Range("A1").Select


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
return what page a named range is on Chris Salcedo Excel Programming 1 January 29th 07 01:35 AM
Page# Return off lookup FASTWRX Excel Programming 5 June 12th 06 06:39 PM
Excel 2002 VBA code to return a page number within a worksheet JCIrish Excel Programming 1 February 19th 06 09:23 PM
Return to Main Page oberon.black[_37_] Excel Programming 1 September 11th 05 05:18 PM
Return no of rows per page Neil Waterworth Excel Programming 4 January 23rd 05 04:53 PM


All times are GMT +1. The time now is 08:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"