VBA Code to target specifc range

TTUK

Board Regular
Joined
Apr 5, 2012
Messages
137
Hi All,

I have a VBA script, which works for the whole column which when clicked it allows the user to select a hyperlink file or folder from the computer and it will insert the link into Excel.

Code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column = 23 Then
If Application.Dialogs(xlDialogInsertHyperlink).Show Then
End If
End If
End Sub


Instead of the VBA script just running in Target.Coloum = 23
I want it to be more specific and only work when you click on the cell range - W8:W400

Is this possible? If so what do I need to change in the VBA?

Thanks!

Flack
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Im going to see if this can go one step further..

Would it be possible to have it doing this ........???

The code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column = 23 and target.row>7 and target.row<401 Then If Application.Dialogs(xlDialogInsertHyperlink).Show Then
End If
End If
End Sub



Example.

If the user was completing Row 8 of the spreadsheet.

If data was showing in the cell Q8, it would show in W8 "Hyperlink folder". W8 is where I have the VBA code above working.

Then when they have selected a hyperlink location it would say in W8 "Link to Folder"


Can this be done? if so it would be amazing!!! :D Thanks!


TTUK
 
Upvote 0
OK I will try and show an example


ROW8:

____Q_____R_____S_____T_____U_____V_____W_____X_____
Auto Code__Date___Status__(blank)__(blank)__(blank)__hyperlink


What I would like to happen.....is!

When the Auto Code is generated in Q8, in W8 it will say "Hyperlink Folder"

Once a hyperlink has been added via the [VBA Code] stated in other post.

The text in W8 will change to say "Link to Folder" which will then allow user to click on text and the folder will open!


Hope this little diagram helps!

- TTUK
 
Upvote 0

Forum statistics

Threads
1,215,016
Messages
6,122,700
Members
449,092
Latest member
snoom82

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top