I have a spreadsheet Sheet1 I have a row with some cell values as shown in Image 1. I am having a problem trying to copy and paste cells from one worksheet to another in excel.
Try this script.
Sub CopyData1()
Dim cell As Range, rw As Long
rw = 2
For Each cell In ActiveSheet.Range("A1:H20")
If Not IsEmpty(cell) = True Then
Worksheets("Sheet2").Cells(rw, 1).Value = cell.Value
rw = rw + 1
End If
Next
End Sub
I'm assuming you have a sheet named 'Sheet2'. If not, just rename the sheet where you want the values copied to.