Oct 18 2019 08:35 AM
At least I imagine it's simple.
I'm not a coder and have barely used macros. However, I need to automate a simple task.
I want to select a specific row, and then copy and paste values into that same row.
The row number is dictated by the number in a particular cell, which is generated in a separate process.
I'm doing something wrong though, and I don't know enough to even know how or what. Here's the VBA. I have highlighted the row it doesn't like.
Dim i As Integer
i = Worksheets("Sheet5").Range("A1").Value
Worksheets("Sheet4").Row(i).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
I've tried multiple variations of that row, comparing with bits of code that I know work, but all unsuccessful.
Any help gratefully received.
Oct 18 2019 11:18 AM
Try this code. Works for me.
Sub Macro1()
RowNum = Sheets("Sheet1").Range("A1")
Sheets("Sheet2").Select
Rows(RowNum).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub