#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 189
Default HYPERLINK BY VBA

hi,
I have a dynamic hyperlink by the following code:

Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Select

it works well but the problem is like when I drag a formula like
this,=IF(C127,"YY"," ") in column A. it's like for example when the cell C127
is not empty the the cell A127 will be YY and so on.
in this case the active cell jumps to the last cell in which we have
the formula, but I want it go to the last cell with "YY".
any help?
thanx

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default HYPERLINK BY VBA

First, that doesn't look like a hyperlink to me.
Second,
=if(c127,"yy"," ")
could leave a space character in that cell. I can't think of a time when this
is better than returning "" (no space character).

I'd use:
=if(cl27,"yy","")
The cell will still look empty, but might make other formulas easier to write:
=if(trim(a999)="", ...
is uglier than:
=if(a999="",...

Third, you can use Edit|find in your code to look for that YY value:

Dim FoundCell as range
with activesheet
with .range("a:a")
Set FoundCell = .Cells.Find(what:="yy", _
after:=.Cells(1), _
LookIn:=xlValues, _
lookat:=xlWhole, _
SearchOrder:=xlByRows, _
searchdirection:=xlPrevious, _
MatchCase:=False)
end with
end with

if foundcell is nothing then
msgbox "YY wasn't found!"
else
application.goto foundcell, scroll:=true
end if

(Untested, uncompiled. Watch for typos.)

Searching after the first cell in the range, but with a direction of xlprevious,
will find that last cell with yy in it.





peyman wrote:

hi,
I have a dynamic hyperlink by the following code:

Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Select

it works well but the problem is like when I drag a formula like
this,=IF(C127,"YY"," ") in column A. it's like for example when the cell C127
is not empty the the cell A127 will be YY and so on.
in this case the active cell jumps to the last cell in which we have
the formula, but I want it go to the last cell with "YY".
any help?
thanx


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 189
Default HYPERLINK BY VBA

thanx Dave.too much stuff to read!.i need time.I'll let you know later.

"Dave Peterson" wrote:

First, that doesn't look like a hyperlink to me.
Second,
=if(c127,"yy"," ")
could leave a space character in that cell. I can't think of a time when this
is better than returning "" (no space character).

I'd use:
=if(cl27,"yy","")
The cell will still look empty, but might make other formulas easier to write:
=if(trim(a999)="", ...
is uglier than:
=if(a999="",...

Third, you can use Edit|find in your code to look for that YY value:

Dim FoundCell as range
with activesheet
with .range("a:a")
Set FoundCell = .Cells.Find(what:="yy", _
after:=.Cells(1), _
LookIn:=xlValues, _
lookat:=xlWhole, _
SearchOrder:=xlByRows, _
searchdirection:=xlPrevious, _
MatchCase:=False)
end with
end with

if foundcell is nothing then
msgbox "YY wasn't found!"
else
application.goto foundcell, scroll:=true
end if

(Untested, uncompiled. Watch for typos.)

Searching after the first cell in the range, but with a direction of xlprevious,
will find that last cell with yy in it.





peyman wrote:

hi,
I have a dynamic hyperlink by the following code:

Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Select

it works well but the problem is like when I drag a formula like
this,=IF(C127,"YY"," ") in column A. it's like for example when the cell C127
is not empty the the cell A127 will be YY and so on.
in this case the active cell jumps to the last cell in which we have
the formula, but I want it go to the last cell with "YY".
any help?
thanx


--

Dave Peterson

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
Can't make hyperlink function work for hyperlink to website Frank B Denman Excel Worksheet Functions 15 February 5th 07 11:01 PM
How do I create a hyperlink to a cell with the hyperlink function S. Bevins Excel Worksheet Functions 2 July 20th 06 08:06 PM
Moving rows with Hyperlink doesn't move hyperlink address Samad Excel Discussion (Misc queries) 15 June 22nd 06 12:03 PM
Hyperlink from one sheet to the hyperlink on another AO Excel Discussion (Misc queries) 2 July 5th 05 11:27 AM
Intra-workbook hyperlink: macro/function to return to hyperlink ce marika1981 Excel Discussion (Misc queries) 3 May 6th 05 05:47 AM


All times are GMT +1. The time now is 08:30 PM.

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"