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>
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]7489523[/TD]
[TD="align: right"]08/21/2017[/TD]
[TD="align: right"]6:47:00 PM[/TD]
[TD="align: right"][/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]7489523[/TD]
[TD="align: right"]08/22/2017[/TD]
[TD="align: right"]3:34:00 AM[/TD]
[TD="align: right"][/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]7445261[/TD]
[TD="align: right"]08/22/2017[/TD]
[TD="align: right"]9:08:00 AM[/TD]
[TD="align: right"][/TD]
[TD="align: center"]5[/TD]
[TD="align: right"]7445261[/TD]
[TD="align: right"]08/22/2017[/TD]
[TD="align: right"]9:51:00 AM[/TD]
[TD="align: right"][/TD]
[TD="align: center"]6[/TD]
[TD="align: right"]7084220[/TD]
[TD="align: right"]08/22/2017[/TD]
[TD="align: right"]3:40:00 PM[/TD]
[TD="align: right"][/TD]
[TD="align: center"]7[/TD]
[TD="align: right"]7341942[/TD]
[TD="align: right"]08/22/2017[/TD]
[TD="align: right"]4:18:00 PM[/TD]
[TD="align: right"][/TD]
[TD="align: center"]8[/TD]
[TD="align: right"]7084220[/TD]
[TD="align: right"]08/22/2017[/TD]
[TD="align: right"]4:40:00 PM[/TD]
[TD="align: right"][/TD]
[TD="align: center"]9[/TD]
[TD="align: right"]7084220[/TD]
[TD="align: right"]08/22/2017[/TD]
[TD="align: right"]5:11:00 PM[/TD]
[TD="align: right"][/TD]
</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 | |
---|---|---|---|---|---|---|
SEQ | Notification Status | Date | Date | Time | Shift | |
7489523-Update-42968.7826388889 | Update | |||||
7489523-Final-42969.1486111111 | Final | |||||
7445261-Initial-42969.3805555556 | Initial | |||||
7445261-Final-42969.4104166667 | Final | |||||
7084220-Update-42969.6527777778 | Update | |||||
7341942-Final-42969.6791666667 | Final | |||||
7084220-Update-42969.6944444444 | Update | |||||
7084220-Final-42969.7159722222 | Final |
<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]7489523[/TD]
[TD="align: right"]08/21/2017[/TD]
[TD="align: right"]6:47:00 PM[/TD]
[TD="align: right"][/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]7489523[/TD]
[TD="align: right"]08/22/2017[/TD]
[TD="align: right"]3:34:00 AM[/TD]
[TD="align: right"][/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]7445261[/TD]
[TD="align: right"]08/22/2017[/TD]
[TD="align: right"]9:08:00 AM[/TD]
[TD="align: right"][/TD]
[TD="align: center"]5[/TD]
[TD="align: right"]7445261[/TD]
[TD="align: right"]08/22/2017[/TD]
[TD="align: right"]9:51:00 AM[/TD]
[TD="align: right"][/TD]
[TD="align: center"]6[/TD]
[TD="align: right"]7084220[/TD]
[TD="align: right"]08/22/2017[/TD]
[TD="align: right"]3:40:00 PM[/TD]
[TD="align: right"][/TD]
[TD="align: center"]7[/TD]
[TD="align: right"]7341942[/TD]
[TD="align: right"]08/22/2017[/TD]
[TD="align: right"]4:18:00 PM[/TD]
[TD="align: right"][/TD]
[TD="align: center"]8[/TD]
[TD="align: right"]7084220[/TD]
[TD="align: right"]08/22/2017[/TD]
[TD="align: right"]4:40:00 PM[/TD]
[TD="align: right"][/TD]
[TD="align: center"]9[/TD]
[TD="align: right"]7084220[/TD]
[TD="align: right"]08/22/2017[/TD]
[TD="align: right"]5:11:00 PM[/TD]
[TD="align: right"][/TD]
</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: