Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > PC based Database Applications > Microsoft Excel > Follow hyperlink a make targetrow the toprow

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-30-04, 08:56
marcdesmet marcdesmet is offline
Registered User
 
Join Date: May 2002
Posts: 3
Follow hyperlink a make targetrow the toprow

Hi,

I have a hyperlink in a sheet, attached to shape in the same sheet.
Now when that link is clicked, I want the cell to which the hyperlink is directed, to be in the first visible row in the window (usually it will be in the last visible row).

Anyone a solution?

Thanx!
Reply With Quote
  #2 (permalink)  
Old 09-30-04, 23:26
savbill savbill is offline
Registered User
 
Join Date: Feb 2004
Posts: 525
Quote:
Originally Posted by marcdesmet
I want the cell to which the hyperlink is directed, to be in the first visible row in the window (usually it will be in the last visible row).
This poses a problem because a shape with the hyperlink will run the link and will not execute code. The way to do it would be to write code for the action, assign the sub process (macro) to the shape to run the action and don't even use a hyperlink method. But if you must have a hyperlink you could use a workaround to defeat the hyperlink (bookmark) action and run your own code to perform the row move. I did this by creating 2 shape objects, placing a tranparent shape with a macro assigned on top of the shape with the hyperlink. Here's a code example for checking the link and inserting the row at row 1 top of the sheet, using a tranparent shape overtop the shape with a link assinged.
Code:
Sub Oval_2_Click() ' check the name of the hyperlink bookmark range strLinkRange = ActiveSheet.Shapes("AutoShape 1").Hyperlink.Name ' see if range is valid If Not isRange(strLinkRange) Then MsgBox "Not a valid bookmark" Exit Sub End If ' set a variable for the bookmarked row intRow = Range(strLinkRange).Row ' cut and insert the row at row 1, or row 2 if sheet has header row Rows(intRow).Cut Rows(1).Insert Shift:=xlDown ' Select row 1 on the sheet Range("A1").Select ' Here you could update the hyperlink value to be Row 1, or 2 if header row ' but then the macro woul dbe obsolete for following clicks End Sub Function isRange(strRange) On Error GoTo isRange_Err Set x = Range(strRange) isRange = True isRange_Exit: Exit Function isRange_Err: isRange = False End Function


#
__________________
~

Bill
Reply With Quote
  #3 (permalink)  
Old 10-04-04, 04:24
marcdesmet marcdesmet is offline
Registered User
 
Join Date: May 2002
Posts: 3
Thanks!

Marc
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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