Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Hello, again Help is appreciated
my customer gives me an address list every month
its a csv file where the company, contact name, etc are in each row. during the month the customer tells me that he only wants, say lines 11,21,22,23,150-155 of 200 recipients only sent the packages on this particular day, and another assortment of recipients in two after that.. so what I'm trying to do is write up a macro where I enter the line numbers ( for example see below ) in say column A. 11 21 22 23 150 151 152 153 154 155 Column B would have a series of numbers ( in this example 1-200 ) I have something here that a co-worker did but it appears to be a bit clumsy only because it limits the max row number to 1200. I'm not really asking for my work to be done for me all together (as you have all been very helpful in doing so before :) ) What I'm looking for is a formula that (I believe) to be an ISNUMBER(vlookup combination if this can be suggested I would appreciate it... the macro my coworker did is shown below for reference she has entered "=IF(ISNUMBER(VLOOKUP(RC[1],R1C3:R1200C4,1,FALSE)),""*"","""")" however i've tried to interperet this and don't understand how it works. (NOTE: coworker no longer available to ask for assistance) Dim lngNumRows As Long Dim intStartAddress, IntEndAddress As Long lngNumRows = ActiveSheet.UsedRange.Rows.Count Columns("B:B").Select Selection.Insert Shift:=xlToRight Columns("A:A").Select Selection.Insert Shift:=xlToRight Selection.Insert Shift:=xlToRight Columns("D:D").Select ActiveCell.FormulaR1C1 = "" Columns("D:D").Select Selection.Replace What:="", Replacement:="*", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False Range("B1").Select ActiveCell.FormulaR1C1 = "1" Range("B2").Select ActiveCell.FormulaR1C1 = "2" Range("B1:B2").Select Selection.AutoFill Destination:=Range("B1:B" & Trim(CStr(lngNumRows))), Type:=xlFillDefault Range("B1:B" & Trim(CStr(lngNumRows))).Select ActiveWindow.ScrollRow = 1 Range("A1").Select ActiveCell.FormulaR1C1 = _ "=IF(ISNUMBER(VLOOKUP(RC[1],R1C3:R1200C4,1,FALSE)),""*"","""")" Range("A1").Select Selection.AutoFill Destination:=Range("A1:A" & Trim(CStr(lngNumRows))), Type:=xlFillDefault Range("A1:A" & Trim(CStr(lngNumRows))).Select Columns("A:A").Select Range("A1").Activate Selection.Copy Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Range("A1").Select Application.CutCopyMode = False Range("A1").Select ActiveWindow.ScrollRow = 1 Columns("B:D").Select Selection.Delete Shift:=xlToLeft Cells.Select Selection.Sort Key1:=Range("A1"), Order1:=xlDescending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Range("A" & ActiveSheet.UsedRange.Rows.Count).Select Cells.Find(What:="~*", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _ xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False _ ).Activate IntEndAddress = ActiveCell.Row strTestValue = "A1:Z" & IntEndAddress ActiveSheet.Range(strTestValue).Select Selection.Cut Workbooks.Add ActiveSheet.Paste Columns("A:A").EntireColumn.AutoFit Cells.Select Cells.EntireColumn.AutoFit Columns("A:A").Select Selection.Delete Shift:=xlToLeft ActiveWindow.ActivateNext Selection.Delete Shift:=xlUp Columns("A:A").Select Selection.Delete Shift:=xlToLeft Range("A1").Select End Sub Thanks again G |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|