I have a master file containing 12000 item numbers in Column A and hyperlinked document for each item number in column B.
Now I have made a macro code (shown at the end) which is automatically display as soon as I scan the item number in Cell C1.
Now everything was working fine. But As I started creating real master file, Instead of hyperlinking by right clicking on cell, selecting hyperlink, and then choosing file location, I am hyperlinking it by using Hyperlink function as it is more convinient for me as all file locations are same and in same folder So I am just using =Hyperlink(D2&E2\) in B2 where D column contains file path and E columns contains part number.
Now hyperlink has been created as when I am clicking on it it is getting opened(So that is not a problem)
But now when I am running Macro it is showing me this error:
Run time error 9:subscript out of Range
and showing debug in ActiveCell.Hyperlinks(1).Follow
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("C1")) Is Nothing Then macro
Dim myR As Range
Set myR = Worksheets("Sheet1").Range("A:A").Find( _
If Not myR Is Nothing Then
With Range("B" & ActiveCell.Row)
MsgBox "Item Number Not Found. Please check The Number You have Entered"
It's always difficult to debug from code alone - my GUESS is that more than or less than one cell is active - so I'd try putting msgbox activecell.address before the instruction to follow a hyperlink - this would confirm which cell is deemed to be active, which may help resolve the problem - you could also put in an "on error resume next" statement which wouldn't resolve the problem but would stop the code erroring (if this is an occassional problem).
I hope this helps but let me know if I can help further.
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here