Help with a macro,

jocote46

Board Regular
Joined
May 11, 2009
Messages
57
Hello,

1.I have the following code that i created but i'm getting an error on the WS.range line , i''m copying the date from column C to D and then i want the Column D date to be formatted to "YYYY" but I'm getting a "Run time error" .
2. I want to use the following array formula on Cell "P2" and copy all the way down to lastrow , using column "C" as reference. but when i tried to use the formula it didn't work.


VBA Code:
Sub APsummaries()

Dim WS As Worksheet
Set WS = ActiveSheet

ActiveSheet.Select
Range("C:C").Copy
Range("D:D").Insert
Range("D1").Value = "Year"
WS.Range("D:D") = Application.WorksheetFunction.Text(WS.Range("D:D"), "yyyy")
Columns("H").NumberFormat = "General"
Range("N1").Value = "Top 10"
Range("O1").Value = "Aging per Inv"
Range("P1").Value = "Aging Bucket per Inv"
Range("Q1").Value = "BU"
Range("O2").Formula = "=DAYS(TODAY(), C2)"
Range("P2"),Formula = "=IF(O2>90,"91 and Over",IF(O2>60,"61-90 days",IF(O2>30,"31-60 days",IF(O2<0,"Future Due","Current Period"))))"
Range("Q2").Formula = "=VLOOKUP(X2,'[Adaptive Level Hierarchy by Geoff 8.21.20_WA.xlsx]Sheet2'!$A$2:$B$300,2,0)"

End Sub

Thank you in advance for your expertise and assistance. let me know if you have any questions.
 
Glad we could help & thanks for the feedback.
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,214,654
Messages
6,120,758
Members
448,991
Latest member
Hanakoro

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top