Hello,
I have a excel sheet called Sheet1 which has multiple rows of data. What I want to do is have the rows with data in them to be copied and pasted to another sheet called Data. I wrote some VBA to help me with this, but I think my code is too long and I was wandering if there was a way to condense it. Also is there a way to determine if no data is a row to not copy it over to the Sheet called Data.
Here is the code:
Option Explicit
Sub DataEnter_Click()
Dim nextrow As Integer
nextrow = Sheets("Data").Range("A" & Rows.Count).End(xlUp).Row + 1
If Sheets("Sheet1").Range("A7").Value > 0 Then
Sheets("Sheet1").Range("A7:F7").Copy
If Sheets("Sheet1").Range("A7").Value And Sheets("Sheet1").Range("A8").Value > 0 Then
Sheets("Sheet1").Range("A7:I8").Copy
If Sheets("Sheet1").Range("A7").Value And Sheets("Sheet1").Range("A8").Value And Sheets("Sheet1").Range("A9").Value > 0 Then
Sheets("Sheet1").Range("A7:I9").Copy
Sheets("Data").Range("A" & nextrow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End If
End If
End If
End Sub
Thanks
Bookmarks