Help with a macro,

jocote46

New Member
Joined
May 11, 2009
Messages
43
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.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,613
Office Version
  1. 365
Platform
  1. Windows
Glad we could help & thanks for the feedback.
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Watch MrExcel Video

Forum statistics

Threads
1,127,711
Messages
5,626,420
Members
416,183
Latest member
IanA

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
Top