Setofskills
New Member
- Joined
- Aug 17, 2015
- Messages
- 9
I'm a bit out of my element here and have written a script that will bring in some new project numbers and it puts those on the bottom of Column B. Column A contains formulas (Column A is an error check), Column B is the list of project numbers, Column C through AC are formulas based off of the project number in column B. I can't figure out how to fill the data to the last row of data. Here is what I've attempted to do, I've done my best to explain what I think it is I'm doing (note, data headers are in row 1 and 2, data begins in row 3):
Sub Add_Projects_to_List()
' Add new projects to Projects tab
Dim LastRow As Long
Sheets("Monthly Data").Select
' Selecting the Data Tab
ActiveSheet.Range("$A$1:$CV$2000").AutoFilter Field:=100, Criteria1:="<>"
Range("A2:A2000").SpecialCells(xlCellTypeVisible).Copy
' Bringing in the new project numbers that are filtered out on the data page. I imagine my range here is overkill, but I also didn't know how to select the range through the last row... not pretty, but it seems to work.
Sheets("Projects").Select
' Trying to put these projects on the Projects tab.
Range("B2").Select
Selection.End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
Application.CutCopyMode = False
' Pasting the Data
Sheets("Monthly Data").ShowAllData
' Clearing the filter
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Range("C3:AC" & LastRow).FillDown
Range("A3:A" & LastRow).FillDown
' This does not work, but it is my attempt to fill all the formulas down to what is the new last row for columns A and C through AC.
Range("A1").Select
End Sub
Any help or advice as to why this doesn't work will be greatly appreciated!!!
Sub Add_Projects_to_List()
' Add new projects to Projects tab
Dim LastRow As Long
Sheets("Monthly Data").Select
' Selecting the Data Tab
ActiveSheet.Range("$A$1:$CV$2000").AutoFilter Field:=100, Criteria1:="<>"
Range("A2:A2000").SpecialCells(xlCellTypeVisible).Copy
' Bringing in the new project numbers that are filtered out on the data page. I imagine my range here is overkill, but I also didn't know how to select the range through the last row... not pretty, but it seems to work.
Sheets("Projects").Select
' Trying to put these projects on the Projects tab.
Range("B2").Select
Selection.End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
Application.CutCopyMode = False
' Pasting the Data
Sheets("Monthly Data").ShowAllData
' Clearing the filter
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Range("C3:AC" & LastRow).FillDown
Range("A3:A" & LastRow).FillDown
' This does not work, but it is my attempt to fill all the formulas down to what is the new last row for columns A and C through AC.
Range("A1").Select
End Sub
Any help or advice as to why this doesn't work will be greatly appreciated!!!