uknwmedontu
New Member
Hi
i have written the following code , which searchs through various columns and basically filters my data and then copies it to the worksheet, but i am facing one problem, the source data has a columns containing hyper links to various other files on the system, but the copied data does not copy the hyperlink, i have to give a presentation at my college and need to sort this problem out by tommorrow afternoon, please help me out with the same.
The code is '
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngCrit As Range
Set rngCrit = wksCrit.Range("CriteriaRng")
Application.EnableEvents = False
Select Case Target.Address
Case Range("SelReg").Address
rngCrit.Cells(2, 1).Value = Target.Value
Case Range("Selcountry").Address
rngCrit.Cells(2, 2).Value = Target.Value
Case Range("SelCount").Address
rngCrit.Cells(2, 3).Value = Target.Value
Case Range("SelCity").Address
rngCrit.Cells(2, 4).Value = Target.Value
Case Range("SelDate").Address
rngCrit.Cells(2, 5).Value = Target.Value
Case Range("WhHotN").Address
rngCrit.Cells(2, 6).Value = Target.Value
Case Range("WhResN").Address
rngCrit.Cells(2, 7).Value = Target.Value
Case Range("WhOffN").Address
rngCrit.Cells(2, 8).Value = Target.Value
Case Range("WhRetN").Address
rngCrit.Cells(2, 9).Value = Target.Value
End Select
If Range("SelReg").Value = "" Then
rngCrit.Cells(2, 1).ClearContents
End If
If Range("Selcountry").Value = "" Then
rngCrit.Cells(2, 2).ClearContents
End If
If Range("SelCount").Value = "" Then
rngCrit.Cells(2, 3).ClearContents
End If
If Range("SelCity").Value = "" Then
rngCrit.Cells(2, 4).ClearContents
End If
If Range("SelDate").Value = "" Then
rngCrit.Cells(2, 5).ClearContents
End If
If Range("WhHotN").Value = "" Then
rngCrit.Cells(2, 6).ClearContents
End If
If Range("WhResN").Value = "" Then
rngCrit.Cells(2, 7).ClearContents
End If
If Range("WhOffN").Value = "" Then
rngCrit.Cells(2, 8).ClearContents
End If
If Range("WhRetN").Value = "" Then
rngCrit.Cells(2, 9).ClearContents
End If
If Not rngCrit Is Nothing Then
wksResRep.Range("B1:W65").AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=rngCrit, _
CopyToRange:=Range("ExtractDetails"), Unique:=False
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
errHandler:
Resume exitHandler
End Sub
Please reply back soon.
Thanks
i have written the following code , which searchs through various columns and basically filters my data and then copies it to the worksheet, but i am facing one problem, the source data has a columns containing hyper links to various other files on the system, but the copied data does not copy the hyperlink, i have to give a presentation at my college and need to sort this problem out by tommorrow afternoon, please help me out with the same.
The code is '
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngCrit As Range
Set rngCrit = wksCrit.Range("CriteriaRng")
Application.EnableEvents = False
Select Case Target.Address
Case Range("SelReg").Address
rngCrit.Cells(2, 1).Value = Target.Value
Case Range("Selcountry").Address
rngCrit.Cells(2, 2).Value = Target.Value
Case Range("SelCount").Address
rngCrit.Cells(2, 3).Value = Target.Value
Case Range("SelCity").Address
rngCrit.Cells(2, 4).Value = Target.Value
Case Range("SelDate").Address
rngCrit.Cells(2, 5).Value = Target.Value
Case Range("WhHotN").Address
rngCrit.Cells(2, 6).Value = Target.Value
Case Range("WhResN").Address
rngCrit.Cells(2, 7).Value = Target.Value
Case Range("WhOffN").Address
rngCrit.Cells(2, 8).Value = Target.Value
Case Range("WhRetN").Address
rngCrit.Cells(2, 9).Value = Target.Value
End Select
If Range("SelReg").Value = "" Then
rngCrit.Cells(2, 1).ClearContents
End If
If Range("Selcountry").Value = "" Then
rngCrit.Cells(2, 2).ClearContents
End If
If Range("SelCount").Value = "" Then
rngCrit.Cells(2, 3).ClearContents
End If
If Range("SelCity").Value = "" Then
rngCrit.Cells(2, 4).ClearContents
End If
If Range("SelDate").Value = "" Then
rngCrit.Cells(2, 5).ClearContents
End If
If Range("WhHotN").Value = "" Then
rngCrit.Cells(2, 6).ClearContents
End If
If Range("WhResN").Value = "" Then
rngCrit.Cells(2, 7).ClearContents
End If
If Range("WhOffN").Value = "" Then
rngCrit.Cells(2, 8).ClearContents
End If
If Range("WhRetN").Value = "" Then
rngCrit.Cells(2, 9).ClearContents
End If
If Not rngCrit Is Nothing Then
wksResRep.Range("B1:W65").AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=rngCrit, _
CopyToRange:=Range("ExtractDetails"), Unique:=False
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
errHandler:
Resume exitHandler
End Sub
Please reply back soon.
Thanks