Hello everyone,
I was hoping to have some help changing the following code.
I would like the end product to insert a column between a dynamic range of existing columns with the following equation in each cell within the new columns.
The data table start off looking like this:
<tbody>
</tbody>
And the final product would look like this:
<tbody>
</tbody>
So far I have this:
Thank you in advance for any help you can provide.
I was hoping to have some help changing the following code.
I would like the end product to insert a column between a dynamic range of existing columns with the following equation in each cell within the new columns.
The data table start off looking like this:
Well ID | Date Sampled | PCE | TCE |
VW-1 | 1/25/2008 | ND<5.0 | ND<5.0 |
VW-1 | 6/20/2008 | ND<5.0 | ND<5.0 |
VW-1 | 9/23/2008 | ND<0.50 | ND<0.50 |
VW-1 | 11/5/2008 | ND<0.50 | 1.9 |
VW-1 | 3/16/2009 | ND<0.50 | 1.6 |
VW-1 | 6/2/2009 | ND<0.50 | 1.4 |
VW-1 | 9/17/2010 | ND<0.50 | ND<0.50 |
<tbody>
</tbody>
And the final product would look like this:
Well ID | Date Sampled | PCE | TCE | ||
VW-1 | 1/25/2008 | ND<5.0 | =IF(ISBLANK([RC]-1),"",IF(ISTEXT([RC]-1),0,1)) | ND<5.0 | =IF(ISBLANK([RC]-1),"",IF(ISTEXT([RC]-1),0,1)) |
VW-1 | 6/20/2008 | ND<5.0 | =IF(ISBLANK([RC]-1),"",IF(ISTEXT([RC]-1),0,1)) | ND<5.0 | =IF(ISBLANK([RC]-1),"",IF(ISTEXT([RC]-1),0,1)) |
VW-1 | 9/23/2008 | ND<0.50 | =IF(ISBLANK([RC]-1),"",IF(ISTEXT([RC]-1),0,1)) | ND<0.50 | =IF(ISBLANK([RC]-1),"",IF(ISTEXT([RC]-1),0,1)) |
VW-1 | 11/5/2008 | ND<0.50 | =IF(ISBLANK([RC]-1),"",IF(ISTEXT([RC]-1),0,1)) | 1.9 | =IF(ISBLANK([RC]-1),"",IF(ISTEXT([RC]-1),0,1)) |
VW-1 | 3/16/2009 | ND<0.50 | =IF(ISBLANK([RC]-1),"",IF(ISTEXT([RC]-1),0,1)) | 1.6 | =IF(ISBLANK([RC]-1),"",IF(ISTEXT([RC]-1),0,1)) |
VW-1 | 6/2/2009 | ND<0.50 | =IF(ISBLANK([RC]-1),"",IF(ISTEXT([RC]-1),0,1)) | 1.4 | =IF(ISBLANK([RC]-1),"",IF(ISTEXT([RC]-1),0,1)) |
VW-1 | 9/17/2010 | ND<0.50 | =IF(ISBLANK([RC]-1),"",IF(ISTEXT([RC]-1),0,1)) | ND<0.50 | =IF(ISBLANK([RC]-1),"",IF(ISTEXT([RC]-1),0,1)) |
<tbody>
</tbody>
So far I have this:
Code:
Dim i, itotalrows As Integer
Dim strRange As String
itotalrows = ActiveSheet.Range("A65536").End(xlUp).Offset(1, 0).Row
Do While i <= itotalrows
i = i + 1
strRange = "A" & i
strRange2 = "A" & i + 1
If Range(strRange).Text <> Range(strRange2).Text Then
Rows(i + 1).Insert
Rows(i + 1).Formula = "IF(ISBLANK([RC]-1),"",IF(ISTEXT([RC]-1),1,0))"
itotalrows = ActiveSheet.Range("A65536").End(xlUp).Offset(1, 0).Row
i = i + 1
End If
Loop
Thank you in advance for any help you can provide.
Last edited: