Hi,
First time user today and no luck with my first post. I need help.
I need to be able to enter a dynamic number of columns (they change based on the construction period for the project and the reporting period (month, quarter, year)). I can get one column to be inserted, but not the dynamic number that i need. Please help. Been working on this for two days and I know there is a better way than writing a code to highlight the desired number of columns and then insert.
Dim NumberOfColumns As Double
Dim Cols_to_Insert As Double
Dim Period As Double
NumberOfColumns = WorksheetFunction.CountIf(Sheets("Construction").Range("H6:BY6"), ">0")
Period = Worksheets("Financial Evaluation").Range("Fin_mon_length")
Cols_to_Insert = WorksheetFunction.RoundUp(NumberOfColumns / Period, 0)
'Range("G1").Offset(0, 1).EntireColumn.Cells(1, Cols_to_Insert).Insert
'Columns("H:H).Select
Selection.Insert Shift:=Application.CountIf(Range("h10:iz10"), ">0")
Worksheets("Financial Evaluation").Range("C95") = "=XIRR(OFFSET(range("G94"),0,1,1,COUNTIF(range("H10:IZ10"),">0")),OFFSET(range("G10"),0,1,1,COUNTIF(range("H10:IZ10"),">0")))"
Thank you,
Erin
First time user today and no luck with my first post. I need help.
I need to be able to enter a dynamic number of columns (they change based on the construction period for the project and the reporting period (month, quarter, year)). I can get one column to be inserted, but not the dynamic number that i need. Please help. Been working on this for two days and I know there is a better way than writing a code to highlight the desired number of columns and then insert.
Dim NumberOfColumns As Double
Dim Cols_to_Insert As Double
Dim Period As Double
NumberOfColumns = WorksheetFunction.CountIf(Sheets("Construction").Range("H6:BY6"), ">0")
Period = Worksheets("Financial Evaluation").Range("Fin_mon_length")
Cols_to_Insert = WorksheetFunction.RoundUp(NumberOfColumns / Period, 0)
'Range("G1").Offset(0, 1).EntireColumn.Cells(1, Cols_to_Insert).Insert
'Columns("H:H).Select
Selection.Insert Shift:=Application.CountIf(Range("h10:iz10"), ">0")
Worksheets("Financial Evaluation").Range("C95") = "=XIRR(OFFSET(range("G94"),0,1,1,COUNTIF(range("H10:IZ10"),">0")),OFFSET(range("G10"),0,1,1,COUNTIF(range("H10:IZ10"),">0")))"
Thank you,
Erin