I have an excel spreadsheet that I upload on to a web page and so most of my users view the excel sheet through internet explorer.
There is a macro in the sheet that laets you type a name into a cell ("Query Sheet").Cells(2, 3) and then it goes and finds all instance of that name in the data sheet that sits behind it ("Results").
When I run it in excel it works fine, but when I open it through IE6 it copies all of the results to the clipboard and then requests the user to select a cell to paste the value to, rather than executing the insert function.
Please help as I don't want them to keep having to download the whole sheet everytime to make it work properly. I have attached the code it uses.
Sub Find_names()
NameToFind = Worksheets("Query Sheet").Cells(2, 3)
ActiveSheet.Range("A10:AA100").Clear
Selection.Font.Bold = True
Application.ScreenUpdating = False
writerow = 10
With Worksheets("Results").Range("E2:E10000")
Set c = .Find(NameToFind, LookIn:=xlValues)
If Not c Is Nothing Then
firstaddress = c.Address
Do
copyrow = Mid(c.Address, InStrRev(c.Address, "$") + 1, Len(c.Address) - InStrRev(c.Address, "$") + 1)
Sheets("Results").Select
Rows(copyrow).Select
Selection.Copy
Sheets("Query Sheet").Select
Cells(writerow, 1).Insert
Sheets("Results").Select
writerow = writerow + 1
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstaddress
End If
End With
Sheets("Query Sheet").Select
Range("C2").Select
Application.ScreenUpdating = True
End Sub
There is a macro in the sheet that laets you type a name into a cell ("Query Sheet").Cells(2, 3) and then it goes and finds all instance of that name in the data sheet that sits behind it ("Results").
When I run it in excel it works fine, but when I open it through IE6 it copies all of the results to the clipboard and then requests the user to select a cell to paste the value to, rather than executing the insert function.
Please help as I don't want them to keep having to download the whole sheet everytime to make it work properly. I have attached the code it uses.
Sub Find_names()
NameToFind = Worksheets("Query Sheet").Cells(2, 3)
ActiveSheet.Range("A10:AA100").Clear
Selection.Font.Bold = True
Application.ScreenUpdating = False
writerow = 10
With Worksheets("Results").Range("E2:E10000")
Set c = .Find(NameToFind, LookIn:=xlValues)
If Not c Is Nothing Then
firstaddress = c.Address
Do
copyrow = Mid(c.Address, InStrRev(c.Address, "$") + 1, Len(c.Address) - InStrRev(c.Address, "$") + 1)
Sheets("Results").Select
Rows(copyrow).Select
Selection.Copy
Sheets("Query Sheet").Select
Cells(writerow, 1).Insert
Sheets("Results").Select
writerow = writerow + 1
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstaddress
End If
End With
Sheets("Query Sheet").Select
Range("C2").Select
Application.ScreenUpdating = True
End Sub