I have the following code to insert columns, but for some reason it won't insert them. It doesn't give an error, the macro just stops and doesn't insert:
Sub Worksheet_S10()
'Activate Workbook
Workbooks("WorkBook.xlsm").Activate
'Activate Worksheet
Workbooks("Workbook.xlsm").Sheets("Sheet1").Activate
'Categorize as Insured or Uninsured
Dim lastRow As Long
lastRow = Range("E" & Rows.Count).End(xlDown).Row
Sheets("sheet1").Range("B10:B" & lastRow).Formula = "=IF(RC[7]>1,""Insured"",""Uninsured"")"
'Create Fiscal Year Based Off of Discharge Date
Sheets("Sheet1").Range("K10:K" & lastRow).Formula = "=YEAR(RC[-7])+(MONTH(RC[-7])>='FY Calculation'!R[-8]C[-10])"
'Insert Columns for Categorization
Workbooks("workbook.xlsm").Sheets("sheet1").Activate
[L9].Resize(, 3).EntireColumn.Insert
Thanks!
End Sub
Sub Worksheet_S10()
'Activate Workbook
Workbooks("WorkBook.xlsm").Activate
'Activate Worksheet
Workbooks("Workbook.xlsm").Sheets("Sheet1").Activate
'Categorize as Insured or Uninsured
Dim lastRow As Long
lastRow = Range("E" & Rows.Count).End(xlDown).Row
Sheets("sheet1").Range("B10:B" & lastRow).Formula = "=IF(RC[7]>1,""Insured"",""Uninsured"")"
'Create Fiscal Year Based Off of Discharge Date
Sheets("Sheet1").Range("K10:K" & lastRow).Formula = "=YEAR(RC[-7])+(MONTH(RC[-7])>='FY Calculation'!R[-8]C[-10])"
'Insert Columns for Categorization
Workbooks("workbook.xlsm").Sheets("sheet1").Activate
[L9].Resize(, 3).EntireColumn.Insert
Thanks!
End Sub