To start, I know just enough VBA to be dangerous. I know my code is sloppy and ineffecient. I'm working on that. I understand that .Select is kind of frowned upon, especially with ranges but I have not figured out the way around it yet.
With that said here is my problem. I have a formula that Board Regulars AlanY and etaf were nice enough to help me with. Now I'm trying to paste that formula in every row when there is something in column A of that row.
Excel 2012
<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
But I get the Run time 1004 error. I have tried it in blank workbooks as well with the same result. Here is the worksheet:
With that said here is my problem. I have a formula that Board Regulars AlanY and etaf were nice enough to help me with. Now I'm trying to paste that formula in every row when there is something in column A of that row.
Code:
Columns("F:F").Select Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("F1").Select
ActiveCell.FormulaR1C1 = "Shift"
Range("F2:F" & Cells(Rows.Count, "A").End(xlUp).Row).FormulaR1C1 = _
"=IF(AND(RC[-1]>=INDEX('Chart Data-Email Shift'!C3,MATCH(""Day Shift Start"",'Chart Data-Email Shift'!C2,0)),RC[-1]<=INDEX('Chart Data-Email Shift'!C3,MATCH(""Day Shift Start"",'Chart Data-Email Shift'!C2,0))+8/24),""Days"",IF(AND(RC[-1]>=INDEX('Chart Data-Email Shift'!C3,MATCH(""Swing Shift Start"",'Chart Data-Email Shift'!C2,0)),RC[-1]<=INDEX('Chart Data-Email Shif" & _
"TCH(""Swing Shift Start"",'Chart Data-Email Shift'!C2,0))+8/24),""Swings"",""Mids""))"
Excel 2012
A | B | C | D | E | F | |
---|---|---|---|---|---|---|
1 | SEQ | Notification Status | Date | Date | Time | Shift |
2 | 7489523-Update-42968.7826388889 | 7489523 | Update | 08/21/2017 | 6:47:00 PM | |
3 | 7489523-Final-42969.1486111111 | 7489523 | Final | 08/22/2017 | 3:34:00 AM | |
4 | 7445261-Initial-42969.3805555556 | 7445261 | Initial | 08/22/2017 | 9:08:00 AM | |
5 | 7445261-Final-42969.4104166667 | 7445261 | Final | 08/22/2017 | 9:51:00 AM | |
6 | 7084220-Update-42969.6527777778 | 7084220 | Update | 08/22/2017 | 3:40:00 PM | |
7 | 7341942-Final-42969.6791666667 | 7341942 | Final | 08/22/2017 | 4:18:00 PM | |
8 | 7084220-Update-42969.6944444444 | 7084220 | Update | 08/22/2017 | 4:40:00 PM | |
9 | 7084220-Final-42969.7159722222 | 7084220 | Final | 08/22/2017 | 5:11:00 PM |
<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
IMPORT-EMAIL
But I get the Run time 1004 error. I have tried it in blank workbooks as well with the same result. Here is the worksheet: