Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi again,
Accidentally hit the Send Now button before I had the question written. Sorry about that. I've got two sheets with values in columns E and A, respectively. I need to loop through column E on the first sheet (wksQB), and have it check column A on the second sheet (wksMDR), and if there's a match, press on to the next cell in the filtered range. If there isn't a match, then the macro is to copy the value on the first sheet to the next open cell in column A on the second sheet. Below is what I've got. It compiles ok, but it's erroring out in a couple spots. Not sure what I'm doing wrong here. I know I can go a longer route and do the cell activate copy find, etc. etc., but I'm trying to keep this code a bit leaner and cleaner. Any help would be apprecieated. Thanks. Frank Sub Macro5() ' Dim nameRange As Range Dim wksQB As Worksheet Dim wksMDR As Worksheet Dim var As Variant Dim cell As Range Set wksQB = ActiveWorkbook.Sheets("QueryBuster") Set wksMDR = ActiveWorkbook.Sheets("MDR Worksheet") Set nameRange = wksQB.Range("E2", Range("A65536").End(xlUp)).SpecialCells(xlCellType Visible) wksQB.Range(nameRange).Select For Each cell In nameRange var = Application.Match(cell, wksMDR.Columns(1), 0) If Not IsError(var) Then GoTo NextVar ActiveCell.Value = wksMDR.Range("A2", Range("A65536").End(xlUp).Offset(1, 0)).Value NextVar: Next cell End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Loop thru filtered sheet, copy unique values to another sheet | Excel Programming | |||
copy unique values into listbox, then modify sheet from these values | Excel Programming | |||
count unique values in a filtered range | Excel Worksheet Functions | |||
Finding unique values from a filtered range | Excel Programming | |||
Paste range of values into filtered sheet | Excel Discussion (Misc queries) |