A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Range("B" & f:"J" & f).Select
should be
Range("B" & f & ":J" & f).Select
It's similar for the others.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
Hope sombody can help me with my code. Im new in this i believe this one is easy.
I get errors in the green lines. I am trying to select a range of a row with the variables created to do te loop. And then i want to copy that row and paste it in the next one.
But the sintaxis is rejected.
Thanks!!!
Sub Macro1()
For i = 2 To 140
f = i - 1
If Range("B" & i) = "" Then
Rows(f).Select
Range("B" & f:"J" & f).Select
Application.CutCopyMode = False
Selection.Copy
Range("B" & i:"J" & i).Select
ActiveSheet.Paste
Rows(f).Select
Range("M" & f:"O" & f).Select
Application.CutCopyMode = False
Selection.Copy
Range("M" & i:"M" & i).Select
ActiveSheet.Paste
End If
Next i
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Range("B" & f:"J" & f).Select
should be
Range("B" & f & ":J" & f).Select
It's similar for the others.
Worked perfectly. Thanks!