hi, im newbie using VBA.i need to design that,every time user change directory in excel,then the hyperlink we assign to the cell will automatically change to that folder.do anybody can help me .plz
hi, im newbie using VBA.i need to design that,every time user change directory in excel,then the hyperlink we assign to the cell will automatically change to that folder.do anybody can help me .plz
[vba]
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<== change to suit
On Error GoTo ws_exit
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Hyperlinks.Add Anchor:=Selection, _
Address:=.Value, _
TextToDisplay:=.Value
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
[/vba]
This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.
__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html
Last edited by Bob Phillips; 11-22-2007 at 02:11 AM.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
tq very much.i try to execute .but nothing happen.can u guide me the step.thanks again
Type the link in cell H1 and it should auto-hyperlink
__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
i would to design code that update the hyperlink everytime user change the folder.like we assign userform,that user need to key in the folder that consist information at(C:\Documents and Settings\asrul\Desktop\AP note).later all hyperlink data(C:\Documents and Settings\asrul\Desktop\AP note\Ap_Notes\A004R.pdf).so that whenver user change folder like E:\Documents and Settings\asrul\Desktop\AP note) and the hyperlink data in cell also will be like (E:\Documents and Settings\asrul\Desktop\AP note\Ap_Notes\A004R.pdf).Is it possible.i need help.plz
i would to design code that update the hyperlink everytime user change the folder.like we assign userform,that user need to key in the folder that consist information at(C:\Documents and Settings\asrul\Desktop\AP note).later all hyperlink data(C:\Documents and Settings\asrul\Desktop\AP note\Ap_Notes\A004R.pdf).so that whenver user change folder like E:\Documents and Settings\asrul\Desktop\AP note) and the hyperlink data in cell also will be like (E:\Documents and Settings\asrul\Desktop\AP note\Ap_Notes\A004R.pdf).Is it possible.i need help.plz