View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default copy paste values macro

Sub foriformulas()'to last row in col J
For i = 4 To cells(rows.count,"J").end(xlup).row
Cells(i, "k").Value = Application.VLookup(Cells(i, "j"), _
Sheets("Sheet2").Range("a1:b56"), 2, 0)
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
Your macro may be GREATLY simplified. What determines the last row to copy
to in col K.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Wanna Learn" wrote in message
...
Hello

This is my macro
Range("K4").Select
ActiveCell.FormulaR1C1 = _

"=IF(ISERROR(VLOOKUP(RC10,Sheet2!R1C1:R56C2,2,FALS E)),"""",VLOOKUP(RC10,Sheet2!R1C1:R56C2,2,FALSE))"
Range("K4").Select
Selection.AutoFill Destination:=Range("K4:K7282")
Range("K4:K7282").Select
Columns("K:K").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("K3").Select
End Sub
I get the results I want but ...This is a macro that I have to run
everyday.
So the auto fill range will be different every day . How do I correct the
macro? thanks