Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
I just started using VB to create macros in Excel recently and I could really use some help.<o></o>
<o></o>
This macro is intended to go through a column of identifiers in one worksheet (OrgNameMatches) and for each cell search if there is a matching identifier in another column in another worksheet (OrgFacilityRelationship) of the same file. If there is a match, then a hyperlink is to be created between the identifier from OrgNameMatches to the identifier in OrgFacilityRelationship.<o></o>
<o></o>
I have the following code so far… (The Run-time error '1004': Application-defined or object-defined error occurs after the following lines:<o></o>
<o></o>
Sheets("OrgFacilityRelationship").Select <o></o>
Range("A2").Select lines<o></o>
<o></o>
<o></o>
<o>
</o>
<o>
</o>
<o></o>
If anyone can please help to resolve the run-time error or if you can point out any other problems with my code, I would greatly appreciate it. Thanks!<o></o>
<o></o>
I just started using VB to create macros in Excel recently and I could really use some help.<o></o>
<o></o>
This macro is intended to go through a column of identifiers in one worksheet (OrgNameMatches) and for each cell search if there is a matching identifier in another column in another worksheet (OrgFacilityRelationship) of the same file. If there is a match, then a hyperlink is to be created between the identifier from OrgNameMatches to the identifier in OrgFacilityRelationship.<o></o>
<o></o>
I have the following code so far… (The Run-time error '1004': Application-defined or object-defined error occurs after the following lines:<o></o>
<o></o>
Sheets("OrgFacilityRelationship").Select <o></o>
Range("A2").Select lines<o></o>
<o></o>
<o></o>
<o>
Code:
Sub orgFacilityLink()
Sheets("OrgNameMatches").Activate
Sheets("OrgNameMatches").Select
Range("A2").Select
Do Until Selection.Offset(1, 0).Value = ""
varIdMatch = False
varIdValue = ActiveCell.Value
varIdRow = ActiveCell.Row
Sheets("OrgFacilityRelationship").Activate
Sheets("OrgFacilityRelationship").Select
Range("A2").Select
Do Until Selection.Offset(1, 0).Value = ""
If Selection.Value = varIdValue Then
varIdMatch = True
varIdMatchRow = ActiveCell.Row
Exit Do
End If
Selection.Offset(1, 0).Select
Loop
Sheets("OrgNameMatches").Select
Range("A" & varIdRow).Select
If varIdMatch = True Then
ActiveCell.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:="Sheet3!A" & varIdMatchRow, TextToDisplay:=varIdValue
End If
Selection.Offset(1, 0).Select
Loop</o:p>
<o:p>End Sub
<o>
</o>
<o></o>
If anyone can please help to resolve the run-time error or if you can point out any other problems with my code, I would greatly appreciate it. Thanks!<o></o>
Last edited by a moderator: