I'm working on a sheet with a formula in column A that will either return "X", or "". If that value is "X" I need the formulas that I have in row 2 (in columns B through Z) for the entire row to be copied to that row (rows 3 through 5000).
I've been working with this code, but it isn't working:
' Select cells to paste
Sheets("SAP Detail").Select
Range("A2:AI2").Select
Selection.Copy
' Remove rows with a 0 (zero) in column A from the SAP Detail page
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long
With ActiveSheet
.Select
'Set the first and last row to loop through
Firstrow = .UsedRange.Cells(2).Row
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row
'We loop from Lastrow to Firstrow (bottom to top)
For Lrow = Lastrow To Firstrow Step -1
'We check the values in column A for "X"
With .Cells(Lrow, "X")
If Not IsError(.Value) Then
If .Value = "X" Then ActiveSheet.Paste
End If
End With
Next Lrow
End With
Can anyone help me identify what I'm missing? I'm getting really burned out on this one. It's a huge macro and this is the one piece that is failing. I think I need someone else's eyes on it.
Thanks to anyone that can assist. I've found a ton of valuable threads here, but this is my first post.
Bookmarks