Hello, i have 2 problems,
#1. at the beginning of my code, I dimmed a lastrow variable to find the last row of the file and then delete the duplicates in the ID filed until the last row (the file may not always have same amount of rows). That works fine. Later I dimmed another lastrow2 variable that I want it to find the last row after the duplicates have been removed. the problem is the lastrow2 variable gives me the same count of rows as the lastrow variable even after some rows have been deleted.
what can i do?
#2. after lastrow2 finds the last row I'm going to have a formula on the first row that i want to copy all the way down until the last row, code seems not to be working
i have posted that part of my code below
any ideas?
'find last row after the dupliactes have been removed
Dim lastRowAfterDuplicatesRemoved As Long
lastRowAfterDuplicatesRemoved = ActiveSheet.UsedRange.Rows.Count
MsgBox (lastRowAfterDuplicatesRemoved)
'index the counties by matching zip codes
Range("N2").Select
ActiveCell.FormulaR1C1 = _
"=INDEX('[All zip codes in FL.xlsx]Sheet1'!R2C1:R1450C4,MATCH(RC[-4],'[All zip codes in FL.xlsx]Sheet1'!R2C1:R1450C1,0),4)"
Selection.Copy
Range("N3:N" & lastRowAfterDuplicatesRemoved).Select
ActiveSheet.Paste
Range("N2:N" & lastRowAfterDuplicatesRemoved).Select
Application.CutCopyMode = False
'paste special values
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False