Hi, I'm trying to paste data into another sheet in the first available column, starting in cell C4. If C4 is not empty, then I would want the code to paste the data in D4, etc. Here's what I have but it's not working as intended. I have attached an image of where I'd like the data to be inserted (highlighted in yellow)
Sub CopyAndClear()
Dim wsData As Worksheet Dim wsDashboard As Worksheet
Set wsData = ThisWorkbook.Sheets("Data") Set wsDashboard = ThisWorkbook.Sheets("Dashboard")
' Copy values from "Data" sheet Column O starting in row 3 wsData.Range("O3:O" & wsData.Cells(wsData.Rows.Count, "O").End(xlUp).Row).Copy
' Find first available column in "Dashboard" sheet starting in cell C4 Dim firstColumn As Long firstColumn = wsDashboard.Cells(4, wsDashboard.Columns.Count).End(xlToLeft).Column + 1
' Paste values in "Dashboard" sheet starting in first available column wsDashboard.Cells(4, firstColumn).PasteSpecial xlPasteValues
End Sub
Sub CopyAndClear()
Dim wsData As Worksheet Dim wsDashboard As Worksheet
Set wsData = ThisWorkbook.Sheets("Data") Set wsDashboard = ThisWorkbook.Sheets("Dashboard")
' Copy values from "Data" sheet Column O starting in row 3 wsData.Range("O3:O" & wsData.Cells(wsData.Rows.Count, "O").End(xlUp).Row).Copy
' Find first available column in "Dashboard" sheet starting in cell C4 Dim firstColumn As Long firstColumn = wsDashboard.Cells(4, wsDashboard.Columns.Count).End(xlToLeft).Column + 1
' Paste values in "Dashboard" sheet starting in first available column wsDashboard.Cells(4, firstColumn).PasteSpecial xlPasteValues
End Sub