mohammadimran
New Member
- Joined
- May 30, 2018
- Messages
- 10
Dear experts,
I have been trying to run this macro however the formula copies only until row number 31 in column. Can you please guide me what is wrong with it?
I am trying to paste formula in column A and then copy it until the last cell. The macro runs just fine but formula only updates until A31. Please help
Sub Column_Adjustment()
Dim Lastrow As Long
Columns("A:C").Cut
Columns("M:M").Insert Shift:=xlToRight
Columns("A:A").Insert Shift:=xlToRight
Range("A1").Value = "Vendor Name"
Range("A2").Formula = "=IFERROR(INDEX('C:\Users\username\Documents\[Vendors List.xlsx]Sheet1'!$C:$C,MATCH(M2,'C:\Users\username\Documents\[Vendors List.xlsx]Sheet1'!$A:$A,0)),0)"
Lastrow = Range("A:A").End(xlUp).Row
Range("A2").Copy
Range(Cells(3 & Lastrow, 1), Cells(Lastrow, 1)).PasteSpecial (xlPasteFormulas)
Application.ScreenUpdating = True
End Sub
I have been trying to run this macro however the formula copies only until row number 31 in column. Can you please guide me what is wrong with it?
I am trying to paste formula in column A and then copy it until the last cell. The macro runs just fine but formula only updates until A31. Please help
Sub Column_Adjustment()
Dim Lastrow As Long
Columns("A:C").Cut
Columns("M:M").Insert Shift:=xlToRight
Columns("A:A").Insert Shift:=xlToRight
Range("A1").Value = "Vendor Name"
Range("A2").Formula = "=IFERROR(INDEX('C:\Users\username\Documents\[Vendors List.xlsx]Sheet1'!$C:$C,MATCH(M2,'C:\Users\username\Documents\[Vendors List.xlsx]Sheet1'!$A:$A,0)),0)"
Lastrow = Range("A:A").End(xlUp).Row
Range("A2").Copy
Range(Cells(3 & Lastrow, 1), Cells(Lastrow, 1)).PasteSpecial (xlPasteFormulas)
Application.ScreenUpdating = True
End Sub