Hi there,
I have a macro that I am using to find if a certain string ("ID1") is found in a range. I posted the code below.
I've had to make some changes to my workbook and I now, instead of looking for a single string, I have to find if any strings in a certain range (sheet("Template2"), column "AH") is found in the other range.
Can anyone suggest how I can change my code below to do that?
Thanks,![]()
ID1 = ws_temp1.Range("M3") & "_" & ws_temp1.Range("N3") & "_" & ws_temp1.Range("O3") 'looks for the ID in the list of previously exported IDs and if found, prompts users to decide whether to export and replace old data or cancel operation. Otherwise, macro exports. If Trim(ID1) <> "" Then With Sheets("ref").Range("P:P") Set rng2 = .Find(What:=ID1, _ After:=.Cells(.Cells.count), _ LookIn:=xlValues, _ Lookat:=xlWhole, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False) If Not rng2 Is Nothing Then Application.GoTo rng2, True If MsgBox("The date range for the selected office has already been uploaded. Would you like to replace this data?", vbYesNo, "Confirm") = vbYes Then MsgBox "Duplicates will be replaced" Call copypasteloop_N_R Call exprt_rows_vbYes Call rec_dates4 Call clear_data ElseIf vbNo Then MsgBox "Export aborted" Call clear_data 'macro stops and clears the 'exporter' of the pasted data Exit Sub End If Else MsgBox "No duplicates found: next macro for export will be begin" 'must continue on with normal process of export Call copypasteloop_N_R Call exprt_rows Call rec_dates4 Call clear_data End If End With End If End If
Goeff











LinkBack URL
About LinkBacks
Register To Reply

Bookmarks